mariadb/extra/mariabackup
Marko Mäkelä 86dc7b4d4c MDEV-24626 Remove synchronous write of page0 file during file creation
During data file creation, InnoDB holds dict_sys mutex, tries to
write page 0 of the file and flushes the file. This not only causing
unnecessary contention but also a deviation from the write-ahead
logging protocol.

The clean sequence of operations is that we first start a dictionary
transaction and write SYS_TABLES and SYS_INDEXES records that identify
the tablespace. Then, we durably write a FILE_CREATE record to the
write-ahead log and create the file.

Recovery should not unnecessarily insist that the first page of each
data file that is referred to by the redo log is valid. It must be
enough that page 0 of the tablespace can be initialized based on the
redo log contents.

We introduce a new data structure deferred_spaces that keeps track
of corrupted-looking files during recovery. The data structure holds
the last LSN of a FILE_ record referring to the data file, the
tablespace identifier, and the last known file name.

There are two scenarios can happen during recovery:
i) Sufficient memory: InnoDB can reconstruct the
tablespace after parsing all redo log records.

ii) Insufficient memory(multiple apply phase): InnoDB should
store the deferred tablespace redo logs even though
tablespace is not present. InnoDB should start constructing
the tablespace when it first encounters deferred tablespace
id.

Mariabackup copies the zero filled ibd file in backup_fix_ddl() as
the extension of .new file. Mariabackup test case does page flushing
when it deals with DDL operation during backup operation.

fil_ibd_create(): Remove the write of page0 and flushing of file

fil_ibd_load(): Return FIL_LOAD_DEFER if the tablespace has
zero filled page0

Datafile: Clean up the error handling, and do not report errors
if we are in the middle of recovery. The caller will check
Datafile::m_defer.

fil_node_t::deferred: Indicates whether the tablespace loading was
deferred during recovery

FIL_LOAD_DEFER: Returned by fil_ibd_load() to indicate that tablespace
file was cannot be loaded.

recv_sys_t::recover_deferred(): Invoke deferred_spaces.create() to
initialize fil_space_t based on buffered metadata and records to
initialize page 0. Ignore the flags in fil_name_t, because they are
intentionally invalid.

fil_name_process(): Update deferred_spaces.

recv_sys_t::parse(): Store the redo log if the tablespace id
is present in deferred spaces

recv_sys_t::recover_low(): Should recover the first page of
the tablespace even though the tablespace instance is not
present

recv_sys_t::apply(): Initialize the deferred tablespace
before applying the deferred tablespace records

recv_validate_tablespace(): Skip the validation for deferred_spaces.

recv_rename_files(): Moved and revised from recv_sys_t::apply().
For deferred-recovery tablespaces, do not attempt to rename the
file if a deferred-recovery tablespace is associated with the name.

recv_recovery_from_checkpoint_start(): Invoke recv_rename_files()
and initialize all deferred tablespaces before applying redo log.

fil_node_t::read_page0(): Skip page0 validation if the tablespace
is deferred

buf_page_create_deferred(): A variant of buf_page_create() when
the fil_space_t is not available yet

This is joint work with Thirunarayanan Balathandayuthapani,
who implemented an initial prototype.
2021-05-17 18:12:33 +03:00
..
quicklz MDEV-9566 Add Percona Xtrabackup 2.3.7 2017-04-27 19:12:39 +02:00
backup_copy.cc Merge 10.5 into 10.6 2021-04-14 12:32:27 +03:00
backup_copy.h MDEV-22929 MariaBackup option to report and/or continue when corruption is encountered 2020-12-01 08:08:57 +03:00
backup_debug.h MDEV-25312 Replace fil_space_t::name with fil_space_t::name() 2021-04-07 18:01:13 +03:00
backup_mysql.cc Merge 10.5 into 10.6 2021-04-14 12:32:27 +03:00
backup_mysql.h MDEV-18438 Don't stream xtrabackup_info of extra-lsndir 2019-09-19 17:47:54 +03:00
backup_wsrep.h Merge 10.1 into 10.2 2019-05-13 17:54:04 +03:00
changed_page_bitmap.cc Merge 10.2 into 10.3 2019-11-06 13:14:31 +02:00
changed_page_bitmap.h Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
CMakeLists.txt MDEV-23043 Refactor Windows service handling 2020-07-04 18:24:40 +02:00
common.h Merge 10.1 into 10.2 2019-05-13 17:54:04 +03:00
datasink.cc Merge 10.2 into 10.3 2019-05-14 17:18:46 +03:00
datasink.h MDEV-25221 Do not remove source file, if copy_file() fails in mariabackup --move-back 2021-03-31 14:23:56 +02:00
ds_archive.cc Merge 10.2 into 10.3 2021-04-09 14:32:06 +03:00
ds_archive.h Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
ds_buffer.cc Merge 10.4 into 10.5 2021-04-14 11:35:39 +03:00
ds_buffer.h Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
ds_compress.cc Merge 10.4 into 10.5 2021-04-14 11:35:39 +03:00
ds_compress.h Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
ds_local.cc Merge 10.4 into 10.5 2021-04-14 11:35:39 +03:00
ds_local.h Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
ds_stdout.cc Merge 10.4 into 10.5 2021-04-14 11:35:39 +03:00
ds_stdout.h Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
ds_tmpfile.cc Merge 10.4 into 10.5 2021-04-14 11:35:39 +03:00
ds_tmpfile.h Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
ds_xbstream.cc Merge 10.4 into 10.5 2021-04-14 11:35:39 +03:00
ds_xbstream.h Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
encryption_plugin.cc Merge 10.2 into 10.3 2020-12-01 14:55:46 +02:00
encryption_plugin.h MDEV-9566 Port Percona Xtrabackup to MariaDB as mariabackup 2017-04-27 19:12:40 +02:00
fil_cur.cc MDEV-24626 Remove synchronous write of page0 file during file creation 2021-05-17 18:12:33 +03:00
fil_cur.h Merge 10.4 into 10.5 2020-12-02 18:29:49 +02:00
innobackupex.cc Merge 10.4 into 10.5 2021-04-14 11:35:39 +03:00
innobackupex.h Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
read_filt.cc Merge branch '10.3' into 10.4 2019-05-19 20:55:37 +02:00
read_filt.h Merge branch '10.3' into 10.4 2019-05-19 20:55:37 +02:00
write_filt.cc Merge 10.4 into 10.5 2020-12-02 18:29:49 +02:00
write_filt.h MDEV-22929 MariaBackup option to report and/or continue when corruption is encountered 2020-12-01 08:08:57 +03:00
wsrep.cc Merge 10.2 into 10.3 2019-05-14 17:18:46 +03:00
xb_regex.h MDEV-14024 PCRE2. 2019-12-21 10:34:02 +01:00
xbcloud.cc Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
xbstream.cc Added 'const' to arguments in get_one_option and find_typeset() 2021-02-08 12:16:29 +02:00
xbstream.h Merge 10.1 into 10.2 2019-05-13 17:54:04 +03:00
xbstream_read.cc MDEV-22641: Provide SIMD optimized wrapper for zlib crc32() (#1558) 2020-06-01 11:34:06 +03:00
xbstream_write.cc MDEV-22641: Provide SIMD optimized wrapper for zlib crc32() (#1558) 2020-06-01 11:34:06 +03:00
xtrabackup.cc MDEV-24626 Remove synchronous write of page0 file during file creation 2021-05-17 18:12:33 +03:00
xtrabackup.h Merge 10.4 into 10.5 2021-04-14 11:35:39 +03:00