summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristian Nielsen <knielsen@knielsen-hq.org>2015-02-23 13:37:34 +0100
committerKristian Nielsen <knielsen@knielsen-hq.org>2015-02-23 13:37:34 +0100
commit79e9ff44d18f5fb986870cfac17fc661fb098098 (patch)
treecd0fc441ae7dba1b999763f471e1cd5a69ee74ab
parent41cfdc838e551958b3b1e3a76f1e91040a628786 (diff)
downloadmariadb-git-79e9ff44d18f5fb986870cfac17fc661fb098098.tar.gz
MDEV-7458: Deadlock in parallel replication can allow following transaction to start replicating too early
In parallel replication, don't rollback inside ha_commit_trans() in case of error. The rollback will be done later, but the parallel replication code needs to run unmark_start_commit() before the rollback to properly control the sequencing of transactions. I did not manage to come up with a reliable automatic test case for this, but I tested it manually.
-rw-r--r--sql/handler.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/sql/handler.cc b/sql/handler.cc
index 518ca7b860d..b92db125cf5 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -1445,7 +1445,13 @@ done:
/* Come here if error and we need to rollback. */
err:
error= 1; /* Transaction was rolled back */
- ha_rollback_trans(thd, all);
+ /*
+ In parallel replication, rollback is delayed, as there is extra replication
+ book-keeping to be done before rolling back and allowing a conflicting
+ transaction to continue (MDEV-7458).
+ */
+ if (!(thd->rgi_slave && thd->rgi_slave->is_parallel_exec))
+ ha_rollback_trans(thd, all);
end:
if (rw_trans && mdl_request.ticket)