Commit 21bb5cdf authored by Jan Lindström's avatar Jan Lindström

MDEV-4223: Galera: InnoDB assertion failure !mutex_own(mutex) in file sync0sync.ic line 207

Analysis: Code acquired kernel_mutex when calling wsrep_innobase_kill_one_trx.
However, functions below also might take kernel mutex thus the assertion. 

Fix: Acquire kernel_mutex only for lock_cancel_waiting_and_release where
it is really needed.
parent 48075397
......@@ -12662,7 +12662,9 @@ wsrep_innobase_kill_one_trx(void *bf_thd_ptr, trx_t *bf_trx, trx_t *victim_trx,
if (wait_lock) {
WSREP_DEBUG("canceling wait lock");
victim_trx->was_chosen_as_deadlock_victim= TRUE;
mutex_enter(&kernel_mutex);
lock_cancel_waiting_and_release(wait_lock);
mutex_exit(&kernel_mutex);
}
wsrep_thd_awake(bf_thd, thd, signal);
......@@ -12753,10 +12755,8 @@ wsrep_abort_transaction(handlerton* hton, THD *bf_thd, THD *victim_thd,
if (victim_trx)
{
mutex_enter(&kernel_mutex);
int rcode = wsrep_innobase_kill_one_trx(
bf_thd, bf_trx, victim_trx, signal);
mutex_exit(&kernel_mutex);
wsrep_srv_conc_cancel_wait(victim_trx);
DBUG_RETURN(rcode);
} else {
......
......@@ -13985,7 +13985,9 @@ wsrep_innobase_kill_one_trx(trx_t *bf_trx, trx_t *victim_trx, ibool signal)
if (wait_lock) {
WSREP_DEBUG("canceling wait lock");
victim_trx->was_chosen_as_deadlock_victim= TRUE;
mutex_enter(&kernel_mutex);
lock_cancel_waiting_and_release(wait_lock);
mutex_exit(&kernel_mutex);
}
wsrep_thd_awake(bf_thd, thd, signal);
......@@ -14076,10 +14078,8 @@ wsrep_abort_transaction(handlerton* hton, THD *bf_thd, THD *victim_thd,
if (victim_trx)
{
mutex_enter(&kernel_mutex);
int rcode = wsrep_innobase_kill_one_trx(bf_trx, victim_trx,
signal);
mutex_exit(&kernel_mutex);
wsrep_srv_conc_cancel_wait(victim_trx);
DBUG_RETURN(rcode);
} else {
......
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