summaryrefslogtreecommitdiff
path: root/sql/sql_class.h
diff options
context:
space:
mode:
authorKristian Nielsen <knielsen@knielsen-hq.org>2015-04-08 11:01:18 +0200
committerKristian Nielsen <knielsen@knielsen-hq.org>2015-04-08 11:01:18 +0200
commit3b961347db2b2ad1d31cf64829a6d0e31795e158 (patch)
tree8790bb8d47eec70ce414064db808ee64656320d1 /sql/sql_class.h
parent880f2273fdc39cd1a2ab28f448cdfbf3d6581af2 (diff)
downloadmariadb-git-3b961347db2b2ad1d31cf64829a6d0e31795e158.tar.gz
MDEV-7888, MDEV-7929: Parallel replication hangs sometimes on ANALYZE TABLE or DDL
The hangs occur when the group_commit_orderer object is freed before the last mark_start_commit() call on it - this loses the wakeup to other waiting worker threads, causing them to hang until killed manually. The object was freed because wakeup_subsequent_commits() was called two early in two places. For MDEV-7888, during ANALYZE TABLE, and for MDEV-7929 during record_gtid() after processing a DDL event. The group_commit_orderer object can be freed when its last transaction has called wait_for_prior_commit(). Fix by implementing a suspend/resume mechanism for wakeup_subsequent_commits() that can be used in places where a transaction is committed without this being the commit of the actual replication event group. Also add a protection mechanism (that asserts in debug builds) which can prevent the too-early free and hang if other similar bugs should remain in other parts of the code.
Diffstat (limited to 'sql/sql_class.h')
-rw-r--r--sql/sql_class.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 5d64837a2c1..e47d335d926 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -3682,6 +3682,15 @@ public:
if (wait_for_commit_ptr)
wait_for_commit_ptr->wakeup_subsequent_commits(wakeup_error);
}
+ wait_for_commit *suspend_subsequent_commits() {
+ wait_for_commit *suspended= wait_for_commit_ptr;
+ wait_for_commit_ptr= NULL;
+ return suspended;
+ }
+ void resume_subsequent_commits(wait_for_commit *suspended) {
+ DBUG_ASSERT(!wait_for_commit_ptr);
+ wait_for_commit_ptr= suspended;
+ }
private: