[Commits] Rev 4447: MDEV-6775: Wrong binlog order in parallel replication in http://bazaar.launchpad.net/~maria-captains/maria/10.0

knielsen at knielsen-hq.org knielsen at knielsen-hq.org
Thu Nov 13 10:49:07 EET 2014

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

revno: 4447
revision-id: knielsen at knielsen-hq.org-20141113084907-mp9gefnqhypddzwi
parent: knielsen at knielsen-hq.org-20141113082040-m33uebbmhy6yfdmv
committer: Kristian Nielsen <knielsen at knielsen-hq.org>
branch nick: work-10.0
timestamp: Thu 2014-11-13 09:49:07 +0100
  MDEV-6775: Wrong binlog order in parallel replication
  In parallel replication, the wait_for_commit facility is used to ensure that
  events are written into the binlog in the correct order. This is handled in an
  optimised way in the binlogging group commit code.
  However, some statements, for example GRANT, are written directly into the
  binlog, outside of the group commit code. There was a bug that this direct
  write does not correctly wait for the prior transactions to have been written
  first, which allows f.ex. GRANT to be written ahead of earlier transactions.
  This patch adds the missing wait_for_prior_commit() before writing directly to
  the binlog.
  However, the problem is still there, although the race is much less likely to
  occur now. The problem is that the optimised group commit code does wakeup of
  following transactions early, before the binlog write is actually done. A
  woken-up following transaction is then allowed to run ahead and queue up for
  the group commit, which will ensure that binlog write happens in correct order
  in the end. However, the code for directly written events currently bypass
  this mechanism, so they get woken up and written too early.
  This will be fixed properly in a later patch.
=== modified file 'sql/log.cc'
--- a/sql/log.cc	2014-10-09 08:30:11 +0000
+++ b/sql/log.cc	2014-11-13 08:49:07 +0000
@@ -5848,7 +5848,10 @@ bool MYSQL_BIN_LOG::write(Log_event *eve
     if (direct)
+      int res;
       DBUG_PRINT("info", ("direct is set"));
+      if ((res= thd->wait_for_prior_commit()))
+        DBUG_RETURN(res);
       file= &log_file;
       my_org_b_tell= my_b_tell(file);

More information about the commits mailing list