[Commits] Rev 4615: MDEV-7458: Deadlock in parallel replication can allow following transaction to start replicating too early in http://bazaar.launchpad.net/~maria-captains/maria/10.0

knielsen at knielsen-hq.org knielsen at knielsen-hq.org
Fri Feb 20 15:18:16 EET 2015


At http://bazaar.launchpad.net/~maria-captains/maria/10.0

------------------------------------------------------------
revno: 4615
revision-id: knielsen at knielsen-hq.org-20150220131816-d7i2zs0duovqjo5a
parent: knielsen at knielsen-hq.org-20150220131711-k66nzlpzsrm4wq48
committer: Kristian Nielsen <knielsen at knielsen-hq.org>
branch nick: work-10.0
timestamp: Fri 2015-02-20 14:18:16 +0100
message:
  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.
=== modified file 'sql/handler.cc'
--- a/sql/handler.cc	2015-01-21 11:03:02 +0000
+++ b/sql/handler.cc	2015-02-20 13:18:16 +0000
@@ -1445,7 +1445,13 @@ int ha_commit_trans(THD *thd, bool all)
   /* 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)



More information about the commits mailing list