summaryrefslogtreecommitdiff
path: root/storage/innobase/srv
diff options
context:
space:
mode:
authorSunny Bains <Sunny.Bains@Oracle.Com>2010-04-28 06:47:47 +1000
committerSunny Bains <Sunny.Bains@Oracle.Com>2010-04-28 06:47:47 +1000
commit248dd65fe76e8fcee1f7eed59f94d331bb000dea (patch)
tree3ba21a510fbd6e1627140731b13b3b16edc9a6a2 /storage/innobase/srv
parente2a3bb5acc3a75e4aa4e382eb048db728eae7cdd (diff)
downloadmariadb-git-248dd65fe76e8fcee1f7eed59f94d331bb000dea.tar.gz
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.
Diffstat (limited to 'storage/innobase/srv')
-rw-r--r--storage/innobase/srv/srv0srv.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
index b539807b0e9..86e80cdd7fb 100644
--- a/storage/innobase/srv/srv0srv.c
+++ b/storage/innobase/srv/srv0srv.c
@@ -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);