Commit a9cda441 authored by Monty's avatar Monty

MDEV-8066 Crash on unloading semisync_master plugin

Bug was that ReplSemiSyncMaster::commitTrx() was waiting on a condition
for state to change, but didn't take into account that one could have
disabled semi-sync during the wait.
parent 2776159e
...@@ -477,6 +477,7 @@ void ReplSemiSyncMaster::add_slave() ...@@ -477,6 +477,7 @@ void ReplSemiSyncMaster::add_slave()
void ReplSemiSyncMaster::remove_slave() void ReplSemiSyncMaster::remove_slave()
{ {
lock(); lock();
assert(rpl_semi_sync_master_clients > 0);
rpl_semi_sync_master_clients--; rpl_semi_sync_master_clients--;
/* Only switch off if semi-sync is enabled and is on */ /* Only switch off if semi-sync is enabled and is on */
...@@ -744,8 +745,10 @@ int ReplSemiSyncMaster::commitTrx(const char* trx_wait_binlog_name, ...@@ -744,8 +745,10 @@ int ReplSemiSyncMaster::commitTrx(const char* trx_wait_binlog_name,
/* /*
At this point, the binlog file and position of this transaction At this point, the binlog file and position of this transaction
must have been removed from ActiveTranx. must have been removed from ActiveTranx.
active_tranxs_ may be NULL if someone disabled semi sync during
cond_timewait()
*/ */
assert(thd_killed(NULL) || assert(thd_killed(NULL) || !active_tranxs_ ||
!active_tranxs_->is_tranx_end_pos(trx_wait_binlog_name, !active_tranxs_->is_tranx_end_pos(trx_wait_binlog_name,
trx_wait_binlog_pos)); trx_wait_binlog_pos));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment