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

Require ib_logfile0 to exist unless innodb_force_recovery=6

Details

    Description

      The primary purpose of the parameter innodb_force_recovery is to allow data to be dumped from a corrupted database.

      Ironically, the parameter may also be used to corrupt a database. Until MDEV-19514 in MariaDB Server 10.5, innodb_force_recovery=4 and larger settings could cause corruption of secondary indexes.

      In all versions, the setting innodb_force_recovery=6 will cause the redo log to be ignored. This setting was somewhat redundant, because a similar effect could be achieved by replacing ib_logfile0 with a logically empty log at the desired log sequence number, or by deleting the ib_logfile0 altogether.

      We must not allow InnoDB to start up when the log file is missing or physically empty, except when the option innodb_force_recovery=6 is specified, to ignore the redo log altogether and to start the database in read-only mode.

      Previously, to allow InnoDB to automatically create a lost log file, a field FIL_PAGE_FILE_FLUSH_LSN was written to the first page of the system tablespace on shutdown, bypassing the redo log and the doublewrite buffer. If the server was killed in the middle of that write, the entire server could fail to start up, due to a corrupted first page of the system tablespace. Because we will no longer automatically create a new log file, we will not update that field in the system tablespace either.

      Attachments

        Issue Links

          Activity

            marko Marko Mäkelä created issue -
            marko Marko Mäkelä made changes -
            Field Original Value New Value
            marko Marko Mäkelä made changes -
            marko Marko Mäkelä made changes -
            Summary Remove innodb_force_recovery=6 and require ib_logfile0 to exist Require ib_logfile0 to exist unless innodb_force_recovery=6
            marko Marko Mäkelä made changes -
            Description The primary purpose of the parameter {{innodb_force_recovery}} is to allow data to be dumped from a corrupted database.

            Ironically, the parameter may also be used to corrupt a database. Until MDEV-19514 in MariaDB Server 10.5, {{innodb_force_recovery=4}} and larger settings could cause corruption of secondary indexes.

            In all versions, the setting {{innodb_force_recovery=6}} will cause the redo log to be ignored. Not only is this setting redundant (the same effect may be achieved by replacing {{ib_logfile0}} with a logically empty log at the desired log sequence number), but it can be invoked way too easily.

            Related to this, we no longer want InnoDB to start up when the log file is missing or physically empty, and the {{FIL_PAGE_FILE_FLUSH_LSN}} field in the first page of the system tablespace will no longer be written on shutdown. That field was used as the log sequence number for a new {{ib_logfile0}} when the InnoDB redo log was missing at startup.
            The primary purpose of the parameter {{innodb_force_recovery}} is to allow data to be dumped from a corrupted database.

            Ironically, the parameter may also be used to corrupt a database. Until MDEV-19514 in MariaDB Server 10.5, {{innodb_force_recovery=4}} and larger settings could cause corruption of secondary indexes.

            In all versions, the setting {{innodb_force_recovery=6}} will cause the redo log to be ignored. This setting was somewhat redundant, because a similar effect could be achieved by replacing {{ib_logfile0}} with a logically empty log at the desired log sequence number, or by deleting the {{ib_logfile0}} altogether.

            We must not allow InnoDB to start up when the log file is missing or physically empty, except when the option {{innodb_force_recovery=6}} is specified, to ignore the redo log altogether and to start the database in read-only mode.

            Previously, to allow InnoDB to automatically create a lost log file, a field {{FIL_PAGE_FILE_FLUSH_LSN}} was written to the first page of the system tablespace on shutdown, bypassing the redo log and the doublewrite buffer. If the server was killed in the middle of that write, the entire server could fail to start up, due to a corrupted first page of the system tablespace. Because we will no longer automatically create a new log file, we will not update that field in the system tablespace either.
            marko Marko Mäkelä made changes -
            Status Open [ 1 ] In Progress [ 3 ]
            marko Marko Mäkelä made changes -
            marko Marko Mäkelä made changes -
            Status In Progress [ 3 ] In Testing [ 10301 ]
            marko Marko Mäkelä made changes -
            Assignee Marko Mäkelä [ marko ] Matthias Leich [ mleich ]
            mleich Matthias Leich made changes -
            Assignee Matthias Leich [ mleich ] Marko Mäkelä [ marko ]
            Status In Testing [ 10301 ] Stalled [ 10000 ]
            marko Marko Mäkelä made changes -
            issue.field.resolutiondate 2022-01-21 15:10:32.0 2022-01-21 15:10:32.553
            marko Marko Mäkelä made changes -
            Fix Version/s 10.8.1 [ 26815 ]
            Fix Version/s 10.8 [ 26121 ]
            Resolution Fixed [ 1 ]
            Status Stalled [ 10000 ] Closed [ 6 ]
            marko Marko Mäkelä made changes -
            marko Marko Mäkelä made changes -
            rob.schwyzer@mariadb.com Rob Schwyzer (Inactive) made changes -
            rob.schwyzer@mariadb.com Rob Schwyzer (Inactive) made changes -
            marko Marko Mäkelä made changes -

            People

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