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

lock_rec_unlock_unmodified() causes deadlock

    XMLWordPrintable

Details

    Description

      lock_rec_unlock_unmodified() is executed either under lock_sys.wr_lock() or under a combination of lock_sys.rd_lock() + record locks hash table cell latch. It also requests page latch to check if locked records were changed by the current transaction or not.

      Usually InnoDB requests page latch to find the certain record on the page, and then requests lock_sys and/or record lock hash cell latch to request record lock. lock_rec_unlock_unmodified() requests the latches in the opposite order, what causes deadlocks. One of the possible scenario for the deadlock is the following:

      1. thread 1 - lock_rec_unlock_unmodified() is invoked under locks hash table cell latch, the latch is acquired;
      2. thread 2 - purge thread acquires page latch and tries to remove delete-marked record, it invokes lock_update_delete(), which requests locks hash table cell latch, held by thread 1;
      3. thread 1 - requests page latch, held by thread 2.

      The above scenario can be reproduced with the attached test case: test.tar.gz .

      Attachments

        Issue Links

          Activity

            People

              vlad.lesin Vladislav Lesin
              vlad.lesin Vladislav Lesin
              Votes:
              1 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

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