Testing a fix of
MDEV-15326 revealed that if the call to trx->lock.table_locks.clear(); is skipped at transaction commit when trx->lock.trx_locks is empty, occasionally a transaction would be left with nonempty trx->lock.table_locks list. This proves that the table_locks is not a subset of trx_locks, like it is expected to be.
We will need a test case for this, so that the bug can be found and fixed. To repeat the assertion failures, revert the following part of the
This should lead to occasional assertion failures on trx->lock.table_locks.empty() on transaction commit.