MDEV-24731 fixup: Another bogus assertion

In commit de407e7cb4d12574806bf4f7830e73908d5ca9e2 a debug assertion
was added that would not always hold: We could have TRX_STATE_PREPARED
here. But, in that case, the transaction should not have been chosen
as a deadlock victim.
This commit is contained in:
Marko Mäkelä 2021-06-14 12:09:12 +03:00
parent 4a184f52b0
commit 74a0a9877b

View File

@ -1850,11 +1850,15 @@ static void lock_wait_end(trx_t *trx)
{
mysql_mutex_assert_owner(&lock_sys.wait_mutex);
ut_ad(trx->mutex_is_owner());
ut_ad(trx->state == TRX_STATE_ACTIVE);
ut_d(const auto state= trx->state);
ut_ad(state == TRX_STATE_ACTIVE || state == TRX_STATE_PREPARED);
ut_ad(trx->lock.wait_thr);
if (trx->lock.was_chosen_as_deadlock_victim.fetch_and(byte(~1)))
{
ut_ad(state == TRX_STATE_ACTIVE);
trx->error_state= DB_DEADLOCK;
}
trx->lock.wait_thr= nullptr;
pthread_cond_signal(&trx->lock.cond);