From b81a403e69feadc9896893ddcddc35e8a1f26cec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 27 Mar 2018 23:17:25 +0300 Subject: [PATCH] lock_rec_enqueue_waiting(): Fix diagnostics This is fixup after commit 8026cd6202bd252dc9baac31d6c8bc39653bd637. We must not silently allow a lock wait to occur during InnoDB data dictionary transactions. The dict_operation_lock is supposed to prevent lock waits, and we want to be aware of any errors. --- storage/innobase/lock/lock0lock.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc index 3633bc0b336..000cb56f1de 100644 --- a/storage/innobase/lock/lock0lock.cc +++ b/storage/innobase/lock/lock0lock.cc @@ -1719,11 +1719,6 @@ lock_rec_enqueue_waiting( trx_t* trx = thr_get_trx(thr); - if (trx->mysql_thd && thd_lock_wait_timeout(trx->mysql_thd) == 0) { - trx->error_state = DB_LOCK_WAIT_TIMEOUT; - return DB_LOCK_WAIT_TIMEOUT; - } - ut_ad(trx_mutex_own(trx)); ut_a(!que_thr_stop(thr)); @@ -1741,6 +1736,11 @@ lock_rec_enqueue_waiting( ut_ad(0); } + if (trx->mysql_thd && thd_lock_wait_timeout(trx->mysql_thd) == 0) { + trx->error_state = DB_LOCK_WAIT_TIMEOUT; + return DB_LOCK_WAIT_TIMEOUT; + } + /* Enqueue the lock request that will wait to be granted, note that we already own the trx mutex. */ lock_t* lock = lock_rec_create(