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

Missing error handling in log resizing around ib_logfile101

    XMLWordPrintable

Details

    Description

      mleich produced an rr replay trace where two SET GLOBAL innodb_log_file_size are starting execution at around the same time. The first one succeeded in creating ib_logfile101 and set a log_sys.resize_lsn target, in an attempt to change innodb_log_file_size from 157286400:

      SET GLOBAL innodb_log_file_size = 104857600 - 52428800;
      

      This operation was terminated by a KILL statement and log_t::resize_abort() was invoked, which correctly reset the log_sys.resize_lsn to 0. However, it failed to delete the ib_logfile101.

      A little later, another connection is executing the following:

      SET GLOBAL innodb_log_file_size = 104857600;
      

      It will fail to create the file ib_logfile101 because the file already exists.

      The error handling of this is incorrect; log_sys.resize_lsn will remain at 1, signaling that log resizing is about to start, which is not the case. This will eventually trigger an assertion failure:

      #6  0x00007aa08a03b507 in __assert_fail (assertion=0x6119ba250330 "resizing == RETAIN_LATCH || (resizing == RESIZING) == (resize_in_progress() > 1)", 
          file=0x6119ba24fbf0 "/data/Server/10.11-MDEV-35699/storage/innobase/log/log0log.cc", line=0x3d2, 
          function=0x6119ba250388 "lsn_t log_t::write_buf() [with resizing_and_latch resizing = log_t::RESIZING; lsn_t = long unsigned int]") at ./assert/assert.c:103
      #7  0x00006119b9cff262 in log_t::write_buf<(log_t::resizing_and_latch)2> (this=0x6119bb4dbb40 <log_sys>) at /data/Server/10.11-MDEV-35699/storage/innobase/log/log0log.cc:978
      #8  log_writer_resizing () at /data/Server/10.11-MDEV-35699/storage/innobase/log/log0log.cc:1196
      #9  0x00006119b9cfd8de in log_write_up_to (lsn=lsn@entry=0xe0e876, durable=0x1, callback=<optimized out>, callback@entry=0x0) at /data/Server/10.11-MDEV-35699/storage/innobase/log/log0log.cc:1172
      

      I was not able to reproduce the latter failure with the following change to a regression test:

      diff --git a/mysql-test/suite/innodb/t/log_file_size_online.test b/mysql-test/suite/innodb/t/log_file_size_online.test
      index bf9f3510592..c50365efe32 100644
      --- a/mysql-test/suite/innodb/t/log_file_size_online.test
      +++ b/mysql-test/suite/innodb/t/log_file_size_online.test
      @@ -36,10 +36,15 @@ SET GLOBAL innodb_log_file_buffering=@save;
       --error ER_INCORRECT_GLOBAL_LOCAL_VAR,ER_UNKNOWN_SYSTEM_VARIABLE
       SET GLOBAL innodb_log_file_mmap=OFF;
       
      +let $datadir= `SELECT @@datadir`;
      +--write_file $datadir/ib_logfile101
      +EOF
       send SET GLOBAL innodb_log_file_size=5242880;
       
       --connect con1,localhost,root
      -send UPDATE t SET b='' WHERE a<10;
      +SET GLOBAL innodb_flush_log_at_trx_commit=1;
      +UPDATE t SET b='' WHERE a<10;
      +send commit;
       
       --connection default
       reap;
      

      The existence of the file would merely cause the test to fail to change the log file size from 4MiB to 5MiB; there was no assertion failure.

      Attachments

        Issue Links

          Activity

            People

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