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

Potential hang in log_t::checkpoint_margin() when using innodb_log_archive=ON

    XMLWordPrintable

Details

    • Can result in hang or crash

    Description

      There is a potential hang in the function log_t::checkpoint_margin() due to a change that was part of MDEV-37949. The following patch should fix this and catch further failures of the same kind:

      diff --git a/storage/innobase/log/log0log.cc b/storage/innobase/log/log0log.cc
      index 5f4a59b41fc..44e62fd1205 100644
      --- a/storage/innobase/log/log0log.cc
      +++ b/storage/innobase/log/log0log.cc
      @@ -2075,11 +2075,12 @@ ATTRIBUTE_COLD void log_t::checkpoint_margin() noexcept
             }
             lsn-= max_age;
           }
      -    else if (resize_log.is_opened())
      -      lsn+= file_size;
      +    else if (resize_log.is_opened() && resize_log.m_file != log.m_file)
      +      lsn+= capacity();
           else
             goto done;
       
      +    ut_ad(lsn <= get_lsn());
           mysql_mutex_lock(&buf_pool.flush_list_mutex);
       
           /* We must wait to prevent the tail of the log overwriting the head. */
      

      I had added the assertion in the MDEV-14992 development branch; that is why saahil flagged this. The fix for that case is to advance lsn by the correct amount, subtracting the 12288-byte checkpoint header from the file size. Also the condition needs to be adjusted: log_t::write_checkpoint() may assign log_sys.resize_log=log_sys.log to indicate that a checkpoint is being written.

      Attachments

        Issue Links

          Activity

            People

              thiru Thirunarayanan Balathandayuthapani
              marko Marko Mäkelä
              Marko Mäkelä Marko Mäkelä
              Thirunarayanan Balathandayuthapani Thirunarayanan Balathandayuthapani
              Saahil Alam Saahil Alam
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0d
                  0d
                  Logged:
                  Time Spent - 0.75h
                  0.75h

                  Git Integration

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