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

Don't hold LOCK_thd_data over commit_ordered

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

          knielsen Kristian Nielsen created issue -
          knielsen Kristian Nielsen made changes -
          Field Original Value New Value
          Status Open [ 1 ] In Progress [ 3 ]

          Pushed to 10.5.

          knielsen Kristian Nielsen added a comment - Pushed to 10.5.
          knielsen Kristian Nielsen made changes -
          Fix Version/s 10.10.7 [ 29018 ]
          Fix Version/s 10.5.24 [ 29517 ]
          Fix Version/s 10.6.17 [ 29518 ]
          Fix Version/s 10.11.7 [ 29519 ]
          Fix Version/s 11.0.5 [ 29520 ]
          Fix Version/s 11.1.4 [ 29024 ]
          Fix Version/s 11.2.3 [ 29521 ]
          Fix Version/s 11.3.2 [ 29522 ]
          Fix Version/s 10.4.32 [ 29300 ]
          Resolution Fixed [ 1 ]
          Status In Progress [ 3 ] Closed [ 6 ]
          serg Sergei Golubchik made changes -
          Fix Version/s 10.10.7 [ 29018 ]

          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.