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.
This commit is contained in:
Monty 2015-11-13 23:43:11 +02:00
parent 2776159e42
commit a9cda4419b

View File

@ -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,
/* /*
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));