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

innodb_log_archive=ON file creation causes log_sys.latch contention

    XMLWordPrintable

Details

    • Not for Release Notes
    • Q2/2026 Server Development

    Description

      I made a questionable design choice in MDEV-37949 in order to simplify the initial implementation of the innodb_log_archive=ON format: When a new ib_*.log file is being created and extended to innodb_log_file_size, we will hold log_sys.latch in exclusive mode. This will create significant contention to other concurrent threads.

      A better choice would be to preallocate a spare file while not holding any mutex. The most natural place for that could be the buf_flush_page_cleaner() thread.

      Creating a file upfront might also allow more graceful handling of out-of-space scenarios. Currently, we intentionally crash the server if we fail to create a log file. If we preallocate a log file, in some cases under moderate write load there could be enough time to gracefully switch to read-only operation. Because this is tricky to test and implement, I would leave this out of the scope of the fix for now.

      Attachments

        1. bt_full_mdev_39162.txt
          43 kB
          Rahul Raj
        2. bt_mdev_39162.txt
          7 kB
          Rahul Raj
        3. info_threads_mdev_39162.txt
          4 kB
          Rahul Raj
        4. log_file_size_32G_archive_off_on.png
          34 kB
          Rahul Raj
        5. Perf_Graph_32G_vs_64G.png
          39 kB
          Rahul Raj
        6. Perf_Graph_Archive_ON_OFF_LWM_0.1_10.png
          53 kB
          Rahul Raj
        7. Perf_Graph_commit_4c3af6ae5e6.png
          32 kB
          Rahul Raj
        8. Perf_Graph_commit_8bf07427966_commit_a5eb5670346.png
          34 kB
          Rahul Raj
        9. perf_graph_patch_4.png
          49 kB
          Rahul Raj
        10. TCOUNT_DIP_commit_4c3af6ae5e6.png
          42 kB
          Rahul Raj
        11. TCOUNT_DIP_GRAPH_COMBINED.png
          58 kB
          Rahul Raj
        12. TCOUNT_DIP_GRAPH_commit_3dac6f552f5.png
          67 kB
          Rahul Raj
        13. TCOUNT_DIP_GRAPH_commit_8bf07427966_commit_a5eb5670346.png
          33 kB
          Rahul Raj
        14. TCOUNT_DIP_GRAPH.png
          39 kB
          Rahul Raj
        15. TCOUNT_DIP_PATCH_4.png
          65 kB
          Rahul Raj
        16. TCOUNT_GRAPH_32G_vs_64G.png
          32 kB
          Rahul Raj
        17. thread_apply_all_bt_mdev_39162.txt
          32 kB
          Rahul Raj

        Issue Links

          Activity

            People

              marko Marko Mäkelä
              marko Marko Mäkelä
              Marko Mäkelä Marko Mäkelä
              Votes:
              0 Vote for this issue
              Watchers:
              4 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.