Mariabackup and BACKUP STAGE Commands
MariaDB starting with 10.4.1
The BACKUP STAGE
commands were introduced in MariaDB 10.4.1.
Contents
The BACKUP STAGE
commands are a set of commands to make it possible to make an efficient external backup tool. The version of Mariabackup that is bundled with MariaDB Community Server does not yet use the BACKUP STAGE
commands in an efficient way.
If you would like to use a version of Mariabackup that uses the BACKUP STAGE
commands in an efficient way, then one option is to use MariaDB Enterprise Backup that is bundled with MariaDB Enterprise Server.
BACKUP STAGE
Commands
The following sections describe how Mariabackup *could* theoretically use each BACKUP STAGE
commands in an efficient way. This does not necessarily mean that MariaDB Enterprise Backup is currently implemented in this exact way.
BACKUP STAGE START
Mariabackup could perform the following tasks in the START
stage:
- Copy all transactional tables.
- Copy all transaction logs.
- The InnoDB redo log will be copied for InnoDB tables.
- The
aria_log_control
andaria_log.N
files will be copied for Aria tables.
BACKUP STAGE FLUSH
Mariabackup could perform the following tasks in the FLUSH
stage:
- Copy all non-transactional tables that are not in use. This list of used tables can be found with SHOW OPEN TABLES.
- Copy all transaction logs.
- The InnoDB redo log will be copied for InnoDB tables.
- The
aria_log_control
andaria_log.N
files will be copied for Aria tables.
At this point data for all old tables should have been copied (except for some system tables).
BACKUP STAGE BLOCK_DDL
Mariabackup could perform the following tasks in the BLOCK_DDL
stage:
- Copy the non-transactional tables that were in use during
STAGE FLUSH
. - Check
ddl.log
for DDL executed before theBLOCK DDL
stage.- The file names of newly created tables can be read from
ddl.log
. - The file names of dropped tables can also be read from
ddl.log
. - The file names of renamed tables can also be read from
ddl.log
, so the files can be renamed instead of re-copying them.
- The file names of newly created tables can be read from
- Copy changes to system log tables.
mysql.general_log
mysql.slow_log
- This is easy as these are append only.
- Copy all transaction logs.
- The InnoDB redo log will be copied for InnoDB tables.
- The
aria_log_control
andaria_log.N
files will be copied for Aria tables.
BACKUP STAGE BLOCK_COMMIT
Mariabackup could perform the following tasks in the BLOCK_COMMIT
stage:
- MyRocks files can be hard linked to the backup directory
- Copy changes to system log tables.
mysql.general_log
mysql.slow_log
- This is easy as these are append only.
- Copy changes to statistics tables.
mysql.table_stats
mysql.column_stats
[[mysqlindex_stats-table|mysql.index_stats
- Copy all transaction logs.
- The InnoDB redo log will be copied for InnoDB tables.
- The
aria_log_control
andaria_log.N
files will be copied for Aria tables.
BACKUP STAGE END
Mariabackup could perform the following tasks in the END
stage:
- Copy MyRocks tables