summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2021-02-05 08:35:15 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2021-02-05 08:35:15 +0200
commitde407e7cb4d12574806bf4f7830e73908d5ca9e2 (patch)
tree40d66cf6ea0a3b19f308cd024deaed2d7dc8ceb7
parentc42ee8a7cf1b1b571f89904f55722e817c9b54fe (diff)
downloadmariadb-git-de407e7cb4d12574806bf4f7830e73908d5ca9e2.tar.gz
MDEV-24731 fixup: bogus assertion
DeadlockChecker::search(): Move a bogus assertion into a condition. If the current transaction is waiting for a table lock (on something else than an auto-increment lock), it is well possible that other transactions are holding not only a conflicting lock, but also an auto-increment lock. This mistake was noticed during the testing of MDEV-24731, but it was accidentally introduced in commit 5f463857645d8016e23afdb02955cdc305bebcfb. lock_wait_end(): Remove an unused variable, and add an assertion.
-rw-r--r--storage/innobase/lock/lock0lock.cc7
1 files changed, 3 insertions, 4 deletions
diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc
index dd14f2ab7ae..12154ea71b0 100644
--- a/storage/innobase/lock/lock0lock.cc
+++ b/storage/innobase/lock/lock0lock.cc
@@ -1845,9 +1845,9 @@ end_wait:
static void lock_wait_end(trx_t *trx)
{
mysql_mutex_assert_owner(&lock_sys.wait_mutex);
+ ut_ad(trx->state == TRX_STATE_ACTIVE);
+ ut_ad(trx->lock.wait_thr);
- que_thr_t *thr= trx->lock.wait_thr;
- ut_ad(thr);
if (trx->lock.was_chosen_as_deadlock_victim)
{
trx->error_state= DB_DEADLOCK;
@@ -6181,8 +6181,7 @@ inline trx_t* DeadlockChecker::search()
layer. These locks are released before commit, so they
can not cause deadlocks with binlog-fixed commit
order. */
- if (m_report_waiters) {
- ut_ad(!(lock->type_mode & LOCK_AUTO_INC));
+ if (m_report_waiters && !(lock->type_mode & LOCK_AUTO_INC)) {
thd_rpl_deadlock_check(m_start->mysql_thd,
trx->mysql_thd);
}