WL#7142: InnoDB: Simplify tablespace discovery during crash recovery

Status: Complete

The objective of this worklog is to eliminate the use of the file system as a
‘data dictionary’ during redo log processing (before applying redo log):

(1) Do not read the first page of all $datadir/*/*.ibd files
(2) Do not check the contents of $datadir/*/*.isl files

After these changes, *.isl files (introduced in WL#5980) will still be
consulted when opening tables after the redo log has been applied.
Also, the existence of *.ibd files will be checked in
dict_check_tablespaces_and_store_max_id(). The *.isl files and the
remaining scan for *.ibd files would be removed as part of the data dictionary work.

The changes (1) and (2) will improve reliability as follows:

(3) We will ignore extra *.ibd files that are not attached to the
InnoDB instance. For example, if the system crashes before the completion
of IMPORT TABLESPACE, there could be files with duplicate space_id that
could currently cause trouble. Thanks the MLOG_FILE_NAME redo log records
introduced in this worklog, redo log apply can sometimes safely ignore such
files, and sometimes issue an error message, telling how to resolve manually.

(4) We will not silently discard redo log records if some *.ibd file is
missing without the redo log containing a MLOG_FILE_DELETE record. For
example, if a file rename went bad, the DBA can manually rename the file and
restart crash recovery. In innodb_force_recovery mode, missing *.ibd files will
continue to be ignored.

(5) Failure scenarios related to inconsistent *.isl files will be
eliminated during redo log apply. Redo log records will contain
references to *.ibd file names; the *.isl files will only be used
after redo log apply when opening tables.

This worklog covers changes to InnoDB redo log processing. It can be
implemented independently of the Global Data Dictionary.

The InnoDB redo log format will be changed as follows:

New redo log record types:

MLOG_FILE_NAME(space_id, first_page_number, filename): Identifies a data file.
MLOG_FILE_RENAME2(space_id, first_page_number, filename, new_filename): Rename.
MLOG_CHECKPOINT (1 byte): Indicates the end of log checkpoint activity.
At least one MLOG_CHECKPOINT must be present after the latest log checkpoint,
or the entire redo log will be ignored.

Repurposed redo log record type (no format change):

MLOG_FILE_DELETE(space_id, first_page_number, filename): Delete a file.
Also, identifies a data file during redo log scan.

For future compatibility with multi-file tablespaces, the new redo log records
will identify the first page number of each file. The first implementation will
write and expect first_page_number=0.

All existing file-based redo log records except MLOG_FILE_DELETE
will be removed and replaced as follows:

MLOG_FILE_CREATE, MLOG_FILE_CREATE2: Replaced with MLOG_FILE_NAME.
MLOG_FILE_RENAME(space_id, table, new_table): Replaced with MLOG_FILE_RENAME2.