summaryrefslogtreecommitdiff
path: root/sql/rpl_gtid.cc
diff options
context:
space:
mode:
authorKristian Nielsen <knielsen@knielsen-hq.org>2014-06-27 13:34:29 +0200
committerKristian Nielsen <knielsen@knielsen-hq.org>2014-06-27 13:34:29 +0200
commit370318f8948a9f6f4366588beff4f3b8b4344a20 (patch)
tree3c4edcefb68281871143a6073d9d34f626fb6c9b /sql/rpl_gtid.cc
parentb9ddeeff241071e484548f0765a6b7c799dee439 (diff)
downloadmariadb-git-370318f8948a9f6f4366588beff4f3b8b4344a20.tar.gz
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.
Diffstat (limited to 'sql/rpl_gtid.cc')
-rw-r--r--sql/rpl_gtid.cc9
1 files changed, 2 insertions, 7 deletions
diff --git a/sql/rpl_gtid.cc b/sql/rpl_gtid.cc
index e480e01874b..dc7c7b972b9 100644
--- a/sql/rpl_gtid.cc
+++ b/sql/rpl_gtid.cc
@@ -666,7 +666,7 @@ end:
if (table_opened)
{
- if (err)
+ if (err || (err= ha_commit_trans(thd, FALSE)))
{
/*
If error, we need to put any remaining elist back into the HASH so we
@@ -680,13 +680,8 @@ end:
}
ha_rollback_trans(thd, FALSE);
- close_thread_tables(thd);
- }
- else
- {
- ha_commit_trans(thd, FALSE);
- close_thread_tables(thd);
}
+ close_thread_tables(thd);
if (in_transaction)
thd->mdl_context.release_statement_locks();
else