Commit 48075397 authored by Jan Lindström's avatar Jan Lindström

MDEV-4233: Galera: assertion: (lock->trx)->wait_lock == lock fails in file lock0lock.c line 796

Analysis: Assertion means that InnoDB transaction lock queue is not
correctly set. Reason seams to be the fact that wrong lock is cancelled.

Fix: We have selected c_lock to be cancelled. Thus we should cancel
and release lock that is waiting for this lock i.e. c_lock->trx->wait_lock.
parent 88f0e0eb
...@@ -3960,11 +3960,25 @@ lock_table_create( ...@@ -3960,11 +3960,25 @@ lock_table_create(
} }
if (c_lock && c_lock->trx->que_state == TRX_QUE_LOCK_WAIT) { if (c_lock && c_lock->trx->que_state == TRX_QUE_LOCK_WAIT) {
if (wsrep_debug) if (wsrep_debug) {
fprintf(stderr, "WSREP: table c_lock in wait: %llu\n", fprintf(stderr, "WSREP: table c_lock in wait: %llu new loc: %llu\n",
(ulonglong) lock->trx->id); (ulonglong) c_lock->trx->id, lock->trx->id);
}
c_lock->trx->was_chosen_as_deadlock_victim = TRUE; c_lock->trx->was_chosen_as_deadlock_victim = TRUE;
lock_cancel_waiting_and_release(c_lock); lock_cancel_waiting_and_release(c_lock->trx->wait_lock);
/* trx might not wait for c_lock, but some other lock
does not matter if wait_lock was released above
*/
if (c_lock->trx->wait_lock == c_lock) {
lock_reset_lock_and_trx_wait(lock);
}
if (wsrep_debug) {
fprintf(stderr, "WSREP: c_lock canceled %llu\n",
(ulonglong) c_lock->trx->id);
}
} }
#else #else
......
...@@ -3943,11 +3943,25 @@ lock_table_create( ...@@ -3943,11 +3943,25 @@ lock_table_create(
} }
if (c_lock && c_lock->trx->que_state == TRX_QUE_LOCK_WAIT) { if (c_lock && c_lock->trx->que_state == TRX_QUE_LOCK_WAIT) {
if (wsrep_debug) if (wsrep_debug) {
fprintf(stderr, "WSREP: table c_lock in wait: %llu\n", fprintf(stderr, "WSREP: table c_lock in wait: %llu new loc: %llu\n",
(ulonglong) lock->trx->id); (ulonglong) c_lock->trx->id, lock->trx->id);
}
c_lock->trx->was_chosen_as_deadlock_victim = TRUE; c_lock->trx->was_chosen_as_deadlock_victim = TRUE;
lock_cancel_waiting_and_release(c_lock); lock_cancel_waiting_and_release(c_lock->trx->wait_lock);
/* trx might not wait for c_lock, but some other lock
does not matter if wait_lock was released above
*/
if (c_lock->trx->wait_lock == c_lock) {
lock_reset_lock_and_trx_wait(lock);
}
if (wsrep_debug) {
fprintf(stderr, "WSREP: c_lock canceled %llu\n",
(ulonglong) c_lock->trx->id);
}
} }
#else #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