If, during crash recovery,
redo logs written after the last log checkpoint, redo logs must be
applied to tablespace files that have changed since the last log
Prior to MySQL 5.7.5, tablespace files were referenced in redo
logs by a
space_id, which is a numeric
identifier. In the file system, however,
tablespaces are known by a
*.ibd file name,
which required that
InnoDB construct a
“space_id-filename” map in order to apply the redo
logs. To construct a map,
InnoDB would traverse
the data directory, reading the ﬁrst page of each
*.ibd ﬁle. This process could result in
unnecessary downtime for MySQL instances with numerous
In MySQL 5.6.6, the introduction of support for the
DIRECTORY clause for
tablespaces further complicated “tablespace
.isl files as
placeholders that point to the actual location of
In MySQL 5.7.5, instead of reading the first page of all
$datadir/*/*.ibd files and checking the
$datadir/*/*.isl files before
applying redo logs, a new redo log record type
MLOG_FILE_NAME) identifies tablespaces that
have been modified since the last checkpoint. Benefits of the
MLOG_FILE_NAME redo log record type include:
Elimination of file system scans prior to redo log application. The
MLOG_FILE_NAMEredo log record provides the information necessary to identify tablespaces that have changed since the last checkpoint.
*.ibdfiles modified since the last checkpoint are accessed.
*.ibdfiles that are not attached to the
InnoDBinstance are ignored when redo logs are applied.
InnoDBno longer silently discards redo log records for missing
*.ibdfiles unless there is an
MLOG_FILE_DELETErecord in the redo log. For example, if a file rename fails, resulting in a “missing”
*.ibdfile, you can manually rename the file and restart crash recovery. Missing
*.ibdfiles are ignored in
The entire redo log is read from the last checkpoint to the detected logical end of the log. If tablespace files that are referenced in the scanned portion of the redo log are missing, startup is refused, avoiding potential version mismatch failures during redo log processing.
Failure scenarios related to inconsistent
*.islfiles are eliminated.
*.islfiles are now only used after redo log apply, when opening tables.
In MySQL 5.7.6, two discovery searches for tablespaces were added
with the introduction of
The first search traverses
SYS_TABLESPACESand related entries in
SYS_DATAFILES, in the internal data dictionary. All previously created general tablespaces are opened, including general tablespaces that are empty.
The second search traverses
SYS_TABLES, in the internal data dictionary. For tables with a SPACE ID greater than 0, the SPACE ID is looked up in
SYS_DATAFILESto ensure that the tablespace is opened.