summaryrefslogtreecommitdiff
path: root/sql/sql_class.h
diff options
context:
space:
mode:
authorKristian Nielsen <knielsen@knielsen-hq.org>2014-11-13 10:31:20 +0100
committerKristian Nielsen <knielsen@knielsen-hq.org>2014-11-13 10:31:20 +0100
commitd08b893b3950cc59452db9826cdc014db7208693 (patch)
tree539f68664820dc00aa4430f1de93afd53de31232 /sql/sql_class.h
parenteec04fb4f6534ec7e1102ee37062fe8c43e89cda (diff)
downloadmariadb-git-d08b893b3950cc59452db9826cdc014db7208693.tar.gz
MDEV-6775: Wrong binlog order in parallel replication: Intermediate commit
The code in binlog group commit around wait_for_commit that controls commit order, did the wakeup of subsequent commits early, as soon as a following transaction is put into the group commit queue, but before any such commit has actually taken place. This causes problems with too early wakeup of transactions that need to wait for prior to commit, but do not take part in the binlog group commit for one reason or the other. This patch solves the problem, by moving the wakeup to happen only after the binlog group commit is completed. This requires a new solution to ensure that transactions that arrive later than the leader are still able to participate in group commit. This patch introduces a flag wait_for_commit::commit_started. When this is set, a waiter can queue up itself in the group commit queue. This way, effectively the wait_for_prior_commit() is skipped only for transactions that participate in group commit, so that skipping the wait is safe. Other transactions still wait as needed for correctness.
Diffstat (limited to 'sql/sql_class.h')
-rw-r--r--sql/sql_class.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 762328c1a23..4ec16bff33d 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -1713,6 +1713,16 @@ struct wait_for_commit
on that function for details.
*/
bool wakeup_subsequent_commits_running;
+ /*
+ This flag can be set when a commit starts, but has not completed yet.
+ It is used by binlog group commit to allow a waiting transaction T2 to
+ join the group commit of an earlier transaction T1. When T1 has queued
+ itself for group commit, it will set the commit_started flag. Then when
+ T2 becomes ready to commit and needs to wait for T1 to commit first, T2
+ can queue itself before waiting, and thereby participate in the same
+ group commit as T1.
+ */
+ bool commit_started;
void register_wait_for_prior_commit(wait_for_commit *waitee);
int wait_for_prior_commit(THD *thd)