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

innodb_log_archive=ON recovery fails if no tablespaces exist

    XMLWordPrintable

Details

    • Can result in unexpected behaviour
    • Q2/2026 Server Development

    Description

      If all InnoDB write-ahead logs are available from the very beginning (the initial LSN=12288), crash recovery should be possible even if all data files are missing. The following will simulate that scenario when executed in an out-of-source tree build directory:

      mysql-test/mtr --mysqld=--innodb-log-archive main.1st
      rm mysql-test/var/mysqld.1/data/ibdata1 mysql-test/var/mysqld.1/data/undo00*
      sql/mariadbd --datadir "$PWD"/mysql-test/var/mysqld.1/data
      

      main 7f0ed40ad551e7db7506b5576f00d1435abb4b72

      2026-05-21 10:08:13 0 [ERROR] InnoDB: redo log file './/ib_0000000000003000.log' exists. Creating system tablespace with existing redo log file is not recommended. Please delete redo log file before creating new system tablespace.
      

      If only the system tablespace is missing, then the message will be different:

      main 7f0ed40ad551e7db7506b5576f00d1435abb4b72

      2026-05-21 10:07:58 0 [ERROR] InnoDB: undo tablespace './/undo001' exists. Creating system tablespace with existing undo tablespaces is not supported. Please delete all undo tablespaces before creating new system tablespace.
      

      A recovery attempt with a dummy empty tablespace file

      touch mysql-test/var/mysqld.1/data/ibdata1
      sql/mariadbd --datadir "$PWD"/mysql-test/var/mysqld.1/data
      

      fails in a different way:

      main 7f0ed40ad551e7db7506b5576f00d1435abb4b72

      2026-05-21 10:15:41 0 [ERROR] InnoDB: The Auto-extending data file './ibdata1' is of a different size 0 pages than specified by innodb_data_file_path
      

      Let us try a bit harder:

      fallocate -l 12m mysql-test/var/mysqld.1/data/ibdata1
      sql/mariadbd --datadir "$PWD"/mysql-test/var/mysqld.1/data
      

      main 7f0ed40ad551e7db7506b5576f00d1435abb4b72

      2026-05-21 10:17:21 0 [Note] InnoDB: Header page consists of zero bytes in datafile: ./ibdata1, Space ID: 0, Flags: 0
      2026-05-21 10:17:21 0 [ERROR] InnoDB: The data file './ibdata1' has the wrong space ID. It should be 0, but 0 was found
      

      echo one|dd bs=4 conv=notrunc seek=7 of=mysql-test/var/mysqld.1/data/ibdata1
      sql/mariadbd --datadir "$PWD"/mysql-test/var/mysqld.1/data
      

      main 7f0ed40ad551e7db7506b5576f00d1435abb4b72

      2026-05-21 10:21:06 0 [Note] InnoDB: End of log at LSN=54104
      2026-05-21 10:21:06 0 [ERROR] InnoDB: The change buffer is corrupted
      

      It would be better if recovery worked in all these scenarios. We would want MDEV-14992 BACKUP SERVER to avoid copying any InnoDB data files that have been created after the start of the archived history.

      Attachments

        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:
              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.