From 4fa5e50edbba856a2fe60d1dde7eb5571f42bd68 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 7 Nov 2002 14:47:25 +0200 Subject: Many files: Fix hang introduced by selective deadlock resolution srv0srv.c, row0mysql.c: Fix hang introduced by selective deadlock resolution + corruption caused by lock timeout or sel deadl res in ON DELETE CASCADE innobase/include/que0que.h: Fix hang introduced by selective deadlock resolution innobase/include/trx0trx.h: Fix hang introduced by selective deadlock resolution innobase/include/ut0ut.h: Fix hang introduced by selective deadlock resolution innobase/lock/lock0lock.c: Fix hang introduced by selective deadlock resolution innobase/log/log0log.c: Fix hang introduced by selective deadlock resolution innobase/que/que0que.c: Fix hang introduced by selective deadlock resolution innobase/row/row0mysql.c: Fix hang introduced by selective deadlock resolution + corruption caused by lock timeout or sel deadl res in ON DELETE CASCADE innobase/srv/srv0srv.c: Fix hang introduced by selective deadlock resolution + corruption caused by lock timeout or sel deadl res in ON DELETE CASCADE innobase/trx/trx0sys.c: Fix hang introduced by selective deadlock resolution innobase/trx/trx0trx.c: Fix hang introduced by selective deadlock resolution --- innobase/que/que0que.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'innobase/que') diff --git a/innobase/que/que0que.c b/innobase/que/que0que.c index 7fa444f6741..a96c8840a03 100644 --- a/innobase/que/que0que.c +++ b/innobase/que/que0que.c @@ -1046,14 +1046,16 @@ que_thr_stop( } /************************************************************************** -A patch for MySQL used to 'stop' a dummy query thread used in MySQL. */ +A patch for MySQL used to 'stop' a dummy query thread used in MySQL. The +query thread is stopped and made inactive, except in the case where +it was put to the lock wait state in lock0lock.c, but the lock has already +been granted or the transaction chosen as a victim in deadlock resolution. */ void que_thr_stop_for_mysql( /*===================*/ que_thr_t* thr) /* in: query thread */ { - ibool stopped = FALSE; trx_t* trx; trx = thr_get_trx(thr); @@ -1067,13 +1069,10 @@ que_thr_stop_for_mysql( /* Error handling built for the MySQL interface */ thr->state = QUE_THR_COMPLETED; - - stopped = TRUE; - } - - if (!stopped) { - /* It must have been a lock wait but the - lock was already released */ + } else { + /* It must have been a lock wait but the lock was + already released, or this transaction was chosen + as a victim in selective deadlock resolution */ mutex_exit(&kernel_mutex); @@ -1081,6 +1080,10 @@ que_thr_stop_for_mysql( } } + ut_ad(thr->is_active == TRUE); + ut_ad(trx->n_active_thrs == 1); + ut_ad(thr->graph->n_active_thrs == 1); + thr->is_active = FALSE; (thr->graph)->n_active_thrs--; @@ -1132,6 +1135,9 @@ que_thr_stop_for_mysql_no_error( trx_t* trx) /* in: transaction */ { ut_ad(thr->state == QUE_THR_RUNNING); + ut_ad(thr->is_active == TRUE); + ut_ad(trx->n_active_thrs == 1); + ut_ad(thr->graph->n_active_thrs == 1); if (thr->magic_n != QUE_THR_MAGIC_N) { fprintf(stderr, -- cgit v1.2.1