summaryrefslogtreecommitdiff
path: root/sql/transaction.cc
diff options
context:
space:
mode:
authorKristian Nielsen <knielsen@knielsen-hq.org>2015-03-13 10:46:00 +0100
committerKristian Nielsen <knielsen@knielsen-hq.org>2015-03-13 14:01:52 +0100
commit184f718fef0101a7559364cb97e22ee568e64c12 (patch)
tree193959f2e1dc0174c9bd50ab1a0569a730ebc85f /sql/transaction.cc
parentbc902a2bfc46add0708896c07621e3707f66d95f (diff)
downloadmariadb-git-184f718fef0101a7559364cb97e22ee568e64c12.tar.gz
MDEV-7249: Performance problem in parallel replication with multi-level slaves
Parallel replication (in 10.0 / "conservative" mode) relies on binlog group commits to group transactions that can be safely run in parallel on the slave. The --binlog-commit-wait-count and --binlog-commit-wait-usec options exist to increase the number of commits per group. But in case of conflicts between transactions, this can cause unnecessary delay and reduced througput, especially on a slave where commit order is fixed. This patch adds a heuristics to reduce this problem. When transaction T1 goes to commit, it will first wait for N transactions to queue up for a group commit. However, if we detect that another transaction T2 is waiting for a row lock held by T1, then we will skip the wait and let T1 commit immediately, releasing locks and let T2 continue. On a slave, this avoids the unfortunate situation where T1 is waiting for T2 to join the group commit, but T2 is waiting for T1 to release locks, causing no work to be done for the duration of the --binlog-commit-wait-usec timeout. (The heuristic seems reasonable on the master as well, so it is enabled for all transactions, not just replication transactions).
Diffstat (limited to 'sql/transaction.cc')
-rw-r--r--sql/transaction.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/sql/transaction.cc b/sql/transaction.cc
index 51d8a08e981..a70c075e142 100644
--- a/sql/transaction.cc
+++ b/sql/transaction.cc
@@ -149,6 +149,8 @@ bool trans_begin(THD *thd, uint flags)
when we come here. We should at some point change this to an assert.
*/
thd->transaction.all.modified_non_trans_table= FALSE;
+ thd->has_waiter= false;
+ thd->waiting_on_group_commit= false;
if (res)
DBUG_RETURN(TRUE);