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

InnoDB tries to write to read-only system tablespace in buf_dblwr_t::init_or_load_pages()

    XMLWordPrintable

Details

    Description

      While trying to reproduce another recovery issue, I found some trouble with the following:

      ./mtr --mysqld=--loose-innodb-undo-tablespaces=3 --rr innodb.row_format_redundant
      rr replay var/log/mysqld.1.rr/mariadbd-2
      

      break sql_print_error
      continue
      

      We can see that InnoDB is trying to write to ibdata1 that it had opened in O_RDONLY mode:

      bb-11.4-release 153225d4b31dfa5ca07c6e42a713e58864de0508

      #0  sql_print_error (format=format@entry=0x56201a2d0fd1 "InnoDB: %s")
          at /mariadb/11/sql/log.cc:9801
      #1  0x000056201b208387 in ib::error::~error (this=this@entry=0x7ffeb3a42550, 
          __in_chrg=<optimized out>) at /usr/include/c++/14/bits/basic_string.h:227
      #2  0x000056201b10aea2 in os_file_write_func (
          type=@0x56201a43f260: {bpage = 0x0, slot = 0x0, node = 0x0, type = IORequest::WRITE_SYNC}, name=<optimized out>, 
          name@entry=0x56201ccc2150 "/dev/shm/11.2/mysql-test/var/tmp/row_format_redundant/ibdata1", file=file@entry=10, buf=buf@entry=0x7f1ec5c04000, 
          offset=<optimized out>, n=<optimized out>)
          at /mariadb/11/storage/innobase/os/os0file.cc:2667
      #3  0x000056201afd6a48 in buf_dblwr_t::init_or_load_pages (
          this=0x56201bdc6a20 <buf_dblwr>, file={m_file = 10}, 
          path=path@entry=0x56201ccc2150 "/dev/shm/11.2/mysql-test/var/tmp/row_format_redundant/ibdata1") at /mariadb/11/storage/innobase/buf/buf0dblwr.cc:329
      #4  0x000056201b03edee in SysTablespace::read_lsn_and_check_flags (
          this=this@entry=0x56201bdcaf00 <srv_sys_space>)
          at /mariadb/11/storage/innobase/fsp/fsp0sysspace.cc:594
      #5  0x000056201b03cbc5 in SysTablespace::open_or_create (
          this=0x56201bdcaf00 <srv_sys_space>, is_temp=is_temp@entry=false, 
          create_new_db=create_new_db@entry=false, 
          sum_new_sizes=sum_new_sizes@entry=0x7ffeb3a42a48)
          at /mariadb/11/storage/innobase/fsp/fsp0sysspace.cc:945
      

      The following crude change fixes this issue:

      diff --git a/storage/innobase/fsp/fsp0sysspace.cc b/storage/innobase/fsp/fsp0sysspace.cc
      index be52e7e4743..92d45403916 100644
      --- a/storage/innobase/fsp/fsp0sysspace.cc
      +++ b/storage/innobase/fsp/fsp0sysspace.cc
      @@ -521,7 +521,7 @@ SysTablespace::open_file(
       
       	case SRV_NOT_RAW:
       		err = file.open_or_create(
      -			!m_ignore_read_only && srv_read_only_mode);
      +			false);
       
       		if (err != DB_SUCCESS) {
       			return(err);
      

      But, another issue would then occur:

      bb-11.4-release 153225d4b31dfa5ca07c6e42a713e58864de0508 with the crude 'fix'

      innodb.row_format_redundant              [ fail ]  Found warnings/errors in server log file!
              Test ended at 2024-05-20 16:40:07
      line
      2024-05-20 16:40:06 0 [ERROR] InnoDB: Failed to open the undo tablespace undo006
      2024-05-20 16:40:06 0 [ERROR] InnoDB: Plugin initialization aborted at srv0start.cc[1620] with error Generic error
      2024-05-20 16:40:07 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
      ^ Found warnings in /dev/shm/11.2/mysql-test/var/log/mysqld.1.err
      

      This feels a bit strange, because nobody requested innodb_undo_tablespaces=6.

      Attachments

        Issue Links

          Activity

            People

              thiru Thirunarayanan Balathandayuthapani
              marko Marko Mäkelä
              Votes:
              0 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.