mirror of
https://github.com/MariaDB/server.git
synced 2026-05-16 11:57:38 +02:00
Fix bug introduced by r3038. When a transaction is rolled back by the
lock monitor thread, it may have locks that are granted to waited to waiting transactions. These waiting transactions will need to be woken up but their trx->lock_wait_timeout flag will be FALSE causing the old code to break. What we need is a flag that covers the entire lock release process not individual transactions. The fix is to move the flag out of trx_t and into srv_sys_t.
This commit is contained in:
parent
e2a3bb5acc
commit
248dd65fe7
3 changed files with 13 additions and 16 deletions
|
|
@ -720,6 +720,14 @@ struct srv_sys_struct{
|
|||
in the waiting_threads array */
|
||||
ulint activity_count; /*!< For tracking server
|
||||
activity */
|
||||
unsigned lock_wait_timeout; /*!< TRUE if the lock monitor
|
||||
thread is rolling back a
|
||||
transaction that has waited
|
||||
for too long for the lock a
|
||||
be granted. We use this flag
|
||||
to track whether the
|
||||
srv_sys->mutex needs to be
|
||||
acquired or not */
|
||||
};
|
||||
|
||||
UNIV_INTERN os_event_t srv_lock_timeout_thread_event;
|
||||
|
|
@ -1773,7 +1781,7 @@ srv_release_mysql_thread_if_suspended(
|
|||
{
|
||||
ut_ad(mutex_own(&kernel_mutex));
|
||||
|
||||
if (!thr_get_trx(thr)->lock_wait_timeout) {
|
||||
if (!srv_sys->lock_wait_timeout) {
|
||||
srv_sys_mutex_enter();
|
||||
} else {
|
||||
ut_ad(srv_sys_mutex_own());
|
||||
|
|
@ -1784,7 +1792,7 @@ srv_release_mysql_thread_if_suspended(
|
|||
os_event_set(thr->slot->event);
|
||||
}
|
||||
|
||||
if (!thr_get_trx(thr)->lock_wait_timeout) {
|
||||
if (!srv_sys->lock_wait_timeout) {
|
||||
srv_sys_mutex_exit();
|
||||
}
|
||||
}
|
||||
|
|
@ -2327,13 +2335,14 @@ srv_lock_check_wait(
|
|||
&& ut_dulint_cmp(trx->id, slot_trx->id) == 0
|
||||
&& trx->wait_lock != NULL) {
|
||||
|
||||
ut_a(!srv_sys->lock_wait_timeout);
|
||||
ut_a(trx->que_state == TRX_QUE_LOCK_WAIT);
|
||||
|
||||
trx->lock_wait_timeout = TRUE;
|
||||
srv_sys->lock_wait_timeout = TRUE;
|
||||
|
||||
lock_cancel_waiting_and_release(trx->wait_lock);
|
||||
|
||||
trx->lock_wait_timeout = FALSE;
|
||||
srv_sys->lock_wait_timeout = FALSE;
|
||||
}
|
||||
|
||||
mutex_exit(&kernel_mutex);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue