- Start a XA transaction, put it in prepare phase
- Start a normal transaction involving several tables
- kill the connection
In this case the 10.4 code will in THD::cleanup() call
trans_xa_detach(), which will reset the transaction flags, and then
The effect will be as in
MDEV-15532: We have active transactions but
no MDL locks to protect against ALTER TABLE.
We can't ignore calling release_transactional_locks() in
THD::cleanup() after trans_xa_detach as in this case we have MDL locks
that will never be removed when THD disappears after cleanup().
One suggested fix is to move the transactional locks from THD to the transaction
and keep the transaction around to be picked up by the connection that will
eventually commit the XA transaction.
In case of server restart, we have to also recover the MDL locks for any
table involved in the XA transaction.