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

SET GLOBAL innodb_log_archive ignores read-only mode

    XMLWordPrintable

Details

    • Can result in data loss

    Description

      The following test would crash InnoDB in log_t::header_rewrite(), either in a fatal signal the memory-mapped path (when attempting to modify the read-only mapping log_sys.buf, or in the pwrite code path:

      --source include/have_innodb.inc
      --let $restart_parameters=--innodb-read-only
      --source include/restart_mysqld.inc
      SET GLOBAL innodb_log_archive=!@@GLOBAL.innodb_log_archive;
      

      2026-09-03 15:28:52 3 [Note] InnoDB: setting innodb_log_archive=1 at innodb_log_recovery_start=54088
      2026-09-03 15:28:52 3 [ERROR] [FATAL] InnoDB: pwrite(log) returned -1, operating system error 9
      

      The expected outcome should be:

      mysqltest: At line 4: query 'SET GLOBAL innodb_log_archive=!@@GLOBAL.innodb_log_archive' failed: ER_INNODB_READ_ONLY (1874): InnoDB is in read only mode
      

      This is achieved by the following patch:

      diff --git a/storage/innobase/log/log0log.cc b/storage/innobase/log/log0log.cc
      index f1834bd8f67..297574a49b6 100644
      --- a/storage/innobase/log/log0log.cc
      +++ b/storage/innobase/log/log0log.cc
      @@ -767,6 +767,12 @@ void log_t::header_rewrite(my_bool archive) noexcept
       @param thd      SQL connection */
       void log_t::set_archive(my_bool archive, THD *thd) noexcept
       {
      +  if (UNIV_UNLIKELY(recv_sys.rpo != 0))
      +  {
      +    my_error(ER_INNODB_READ_ONLY, MYF(0));
      +    return true;
      +  }
      +
         thd_wait_begin(thd, THD_WAIT_DISKIO);
         tpool::tpool_wait_begin();
         lsn_t wait_lsn;
      

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:

                Git Integration

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