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

Don't hold LOCK_thd_data over commit_ordered

    XMLWordPrintable

Details

    Description

      Revert the replication part of this commit:

      commit 6b685ea7b0776430d45b095cb4be3ef0739a3c04
      Author: Sergei Golubchik <serg@mariadb.org>
      Date:   Wed Sep 28 18:55:15 2022 +0200
       
          correctness assert
       
          thd_get_ha_data() can be used without a lock, but only from the
          current thd thread, when calling from anoher thread it *must*
          be protected by thd->LOCK_thd_data
       
          * fix group commit code to take thd->LOCK_thd_data
      

      The group commit code must not take thd->LOCK_thd_data over run_commit_ordered().
      The thd is at this point temporarily transferred to the current thread. Taking LOCK_thd_data incurs a performance penalty for every (binlog) commit. Worse, if any storage engine code implementing the commit_ordered handlerton call would try to take the mutex (to modify THD data), the server would deadlock on a recursive mutex take.

      Instead, set_current_thd() for the duration of the commit_ordered call. If any code should access the current_thd, the correct value is the THD of the transaction being committed here, not the THD of the group commit leader.

      Mailing list thread: https://lists.mariadb.org/hyperkitty/list/developers@lists.mariadb.org/thread/TPJ5RI2F2QFX5T6QWZZIETVC3RNOYPVC/

      Attachments

        Activity

          People

            knielsen Kristian Nielsen
            knielsen Kristian Nielsen
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

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