Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-24324

Having an active XA transaction in THD:cleanup will release MDL locks too early.



    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.4, 10.5, 10.6
    • 10.4
    • XA
    • None


      After the fix of MDEV-15532, 10.2 and 10.3 are fine.
      However the new code in sql/xa.cc has the same issue and crash scenarios
      as MDEV-15532 in the following scenario:

      • 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
      call release_transactional_locks().

      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.


        Issue Links



              serg Sergei Golubchik
              monty Michael Widenius
              0 Vote for this issue
              2 Start watching this issue



                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.