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(