Skip to content

Commit f94d9ab

Browse files
MDEV-20483 Follow-up fix
At commit, trx->lock.table_locks (which is a cache of trx_locks) can consist of NULL pointers. Add a debug assertion for that, and clear the vector.
1 parent b3a7c07 commit f94d9ab

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

storage/innobase/trx/trx0trx.cc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,8 @@ inline void trx_t::release_locks()
561561

562562
if (UT_LIST_GET_LEN(lock.trx_locks))
563563
lock_trx_release_locks(this);
564+
else
565+
lock.table_locks.clear();
564566
}
565567

566568
/********************************************************************//**
@@ -1681,6 +1683,16 @@ trx_commit_in_memory(
16811683
DBUG_LOG("trx", "Autocommit in memory: " << trx);
16821684
trx->state = TRX_STATE_NOT_STARTED;
16831685
} else {
1686+
#ifdef UNIV_DEBUG
1687+
if (!UT_LIST_GET_LEN(trx->lock.trx_locks)) {
1688+
for (lock_list::iterator it
1689+
= trx->lock.table_locks.begin();
1690+
it != trx->lock.table_locks.end();
1691+
it++) {
1692+
ut_ad(!*it);
1693+
}
1694+
}
1695+
#endif /* UNIV_DEBUG */
16841696
trx_mutex_enter(trx);
16851697
trx->commit_state();
16861698
trx_mutex_exit(trx);

0 commit comments

Comments
 (0)