From 5e13093df198bc171e1e43c03a36970ecf9a77f7 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 21 Jun 2012 11:52:54 +0200 Subject: MDEV-359: Server crash when SET GLOBAL rpl_semi_sync_master_enabled = OFF The semisync code does a fast-but-unsafe check for enabled or not without lock, followed by a slow-but-safe check under lock. However, if the slow check failed, the code still referenced not valid data (in an assert() expression), causing a crash. Fixed by not running the incorrect assert when semisync is disabled. --- plugin/semisync/semisync_master.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'plugin') diff --git a/plugin/semisync/semisync_master.cc b/plugin/semisync/semisync_master.cc index 9e857f83d39..cb60d8e67d3 100644 --- a/plugin/semisync/semisync_master.cc +++ b/plugin/semisync/semisync_master.cc @@ -608,6 +608,7 @@ int ReplSemiSyncMaster::commitTrx(const char* trx_wait_binlog_name, set_timespec(start_ts, 0); + DEBUG_SYNC(current_thd, "rpl_semisync_master_commit_trx_before_lock"); /* Acquire the mutex. */ lock(); @@ -738,7 +739,6 @@ int ReplSemiSyncMaster::commitTrx(const char* trx_wait_binlog_name, } } - l_end: /* At this point, the binlog file and position of this transaction must have been removed from ActiveTranx. @@ -747,6 +747,7 @@ int ReplSemiSyncMaster::commitTrx(const char* trx_wait_binlog_name, !active_tranxs_->is_tranx_end_pos(trx_wait_binlog_name, trx_wait_binlog_pos)); + l_end: /* Update the status counter. */ if (is_on()) rpl_semi_sync_master_yes_transactions++; -- cgit v1.2.1 From e7362d457a41a8c8a1925c2d0be59df450511320 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 21 Jun 2012 19:02:53 +0200 Subject: MDEV-359: Fix another case where switch-off semisync could cause a race that ended with server crash. This one was when the code releases and reaquires the lock with pthread_cond_wait() - and semisync is switched off meanwhile. --- plugin/semisync/semisync_master.cc | 1 + 1 file changed, 1 insertion(+) (limited to 'plugin') diff --git a/plugin/semisync/semisync_master.cc b/plugin/semisync/semisync_master.cc index cb60d8e67d3..8573c4dcbde 100644 --- a/plugin/semisync/semisync_master.cc +++ b/plugin/semisync/semisync_master.cc @@ -744,6 +744,7 @@ int ReplSemiSyncMaster::commitTrx(const char* trx_wait_binlog_name, must have been removed from ActiveTranx. */ assert(thd_killed(NULL) || + !getMasterEnabled() || !active_tranxs_->is_tranx_end_pos(trx_wait_binlog_name, trx_wait_binlog_pos)); -- cgit v1.2.1