Commit de407e7c authored by Marko Mäkelä's avatar Marko Mäkelä

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 5f463857.

lock_wait_end(): Remove an unused variable, and add an assertion.
parent c42ee8a7
......@@ -1845,9 +1845,9 @@ dberr_t lock_wait(que_thr_t *thr)
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);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment