summaryrefslogtreecommitdiff
path: root/sql/rpl_parallel.cc
diff options
context:
space:
mode:
authorKristian Nielsen <knielsen@knielsen-hq.org>2015-04-08 11:04:24 +0200
committerKristian Nielsen <knielsen@knielsen-hq.org>2015-04-08 11:04:24 +0200
commit48c10fb5f768dd2860d7107e8bd45f5b4a3a7b18 (patch)
treef0b2b5bf142bccbd09c6977f3a2b56d7d70d7386 /sql/rpl_parallel.cc
parent2b475b567e93c9a2438a835f2236ec3672e7769c (diff)
parent3b961347db2b2ad1d31cf64829a6d0e31795e158 (diff)
downloadmariadb-git-48c10fb5f768dd2860d7107e8bd45f5b4a3a7b18.tar.gz
Merge MDEV-7888 and MDEV-7929 into 10.1.
Diffstat (limited to 'sql/rpl_parallel.cc')
-rw-r--r--sql/rpl_parallel.cc18
1 files changed, 17 insertions, 1 deletions
diff --git a/sql/rpl_parallel.cc b/sql/rpl_parallel.cc
index 002f00aa47c..4212a0e09d5 100644
--- a/sql/rpl_parallel.cc
+++ b/sql/rpl_parallel.cc
@@ -170,8 +170,24 @@ finish_event_group(rpl_parallel_thread *rpt, uint64 sub_id,
/* Now free any GCOs in which all transactions have committed. */
group_commit_orderer *tmp_gco= rgi->gco;
while (tmp_gco &&
- (!tmp_gco->next_gco || tmp_gco->last_sub_id > sub_id))
+ (!tmp_gco->next_gco || tmp_gco->last_sub_id > sub_id ||
+ tmp_gco->next_gco->wait_count > entry->count_committing_event_groups))
+ {
+ /*
+ We must not free a GCO before the wait_count of the following GCO has
+ been reached and wakeup has been sent. Otherwise we will lose the
+ wakeup and hang (there were several such bugs in the past).
+
+ The intention is that this is ensured already since we only free when
+ the last event group in the GCO has committed
+ (tmp_gco->last_sub_id <= sub_id). However, if we have a bug, we have
+ extra check on next_gco->wait_count to hopefully avoid hanging; we
+ have here an assertion in debug builds that this check does not in
+ fact trigger.
+ */
+ DBUG_ASSERT(!tmp_gco->next_gco || tmp_gco->last_sub_id > sub_id);
tmp_gco= tmp_gco->prev_gco;
+ }
while (tmp_gco)
{
group_commit_orderer *prev_gco= tmp_gco->prev_gco;