• Kristian Nielsen's avatar
    MDEV-6386: Assertion `thd->transaction.stmt.is_empty() || thd->in_sub_stmt ||... · 370318f8
    Kristian Nielsen authored
    MDEV-6386: Assertion `thd->transaction.stmt.is_empty() || thd->in_sub_stmt || (thd->state_flags & Open_tables_state::BACKUPS_AVAIL)' fails with parallel replication
    
    The direct cause of the assertion was missing error handling in
    record_gtid(). If ha_commit_trans() fails for the statement commit, there was
    missing code to catch the error and do ha_rollback_trans() in this case; this
    caused close_thread_tables() to assert.
    
    Normally, this error case is not hit, but in this case it was triggered due to
    another bug: When a transaction T1 fails during parallel replication, the code
    would signal following transactions that they could start to run without
    properly marking the error condition. This caused subsequent transactions to
    incorrectly start replicating, only to get an error later during their own
    commit step. This was particularly serious if the subsequent transactions were
    DDL or MyISAM updates, which cannot be rolled back and would leave replication
    in an inconsistent state.
    
    Fixed by 1) in case of error, only signal following transactions to continue
    once the error has been properly marked and those transactions will know not
    to start; and 2) implement proper error handling in record_gtid() in the case
    that statement commit fails.
    
    370318f8
rpl_mdev6386.test 1.96 KB