Mariabackup and BACKUP STAGE Commands

MariaDB starting with 10.4.1

The BACKUP STAGE commands were introduced in MariaDB 10.4.1.

The BACKUP STAGE commands are a set of commands to make it possible to make an efficient external backup tool. How Mariabackup uses these commands depends on whether you are using the version that is bundled with MariaDB Community Server or the version that is bundled with MariaDB Enterprise Server.

Mariabackup and BACKUP STAGE Commands in MariaDB Community Server

MariaDB starting with 10.4.1

In MariaDB Community Server, Mariabackup first supported BACKUP STAGE commands in MariaDB 10.4.1.

In MariaDB 10.3 and before, the BACKUP STAGE commands are not supported, so Mariabackup executes the FLUSH TABLES WITH READ LOCK command to lock the database. When the backup is complete, it executes the UNLOCK TABLES command to unlock the database.

In MariaDB 10.4 and later, the BACKUP STAGE commands are supported. However, the version of Mariabackup that is bundled with MariaDB Community Server does not yet use the BACKUP STAGE commands in the most efficient way. Mariabackup simply executes the following BACKUP STAGE commands to lock the database:

BACKUP STAGE START;
BACKUP STAGE BLOCK_COMMIT;

When the backup is complete, it executes the following BACKUP STAGE command to unlock the database:

BACKUP STAGE END;

If you would like to use a version of Mariabackup that uses the BACKUP STAGE commands in the most efficient way, then your best option is to use MariaDB Enterprise Backup that is bundled with MariaDB Enterprise Server.

Tasks Performed Prior to BACKUP STAGE in MariaDB Community Server

  • Copy some transactional tables.
    • InnoDB (i.e. ibdataN and file extensions .ibd and .isl)
  • Copy the tail of some transaction logs.

BACKUP STAGE START in MariaDB Community Server

Mariabackup from MariaDB Community Server does not currently perform any tasks in the START stage.

BACKUP STAGE FLUSH in MariaDB Community Server

Mariabackup from MariaDB Community Server does not currently perform any tasks in the FLUSH stage.

BACKUP STAGE BLOCK_DDL in MariaDB Community Server

Mariabackup from MariaDB Community Server does not currently perform any tasks in the BLOCK_DDL stage.

BACKUP STAGE BLOCK_COMMIT in MariaDB Community Server

Mariabackup from MariaDB Community Server performs the following tasks in the BLOCK_COMMIT stage:

BACKUP STAGE END in MariaDB Community Server

Mariabackup from MariaDB Community Server performs the following tasks in the END stage:

  • Copy the MyRocks checkpoint into the backup.

Mariabackup and BACKUP STAGE Commands in MariaDB Enterprise Server

The following sections describe how the MariaDB Enterprise Backup version of Mariabackup that is bundled with MariaDB Enterprise Server uses each BACKUP STAGE command in an efficient way.

BACKUP STAGE START in MariaDB Enterprise Server

Mariabackup from MariaDB Enterprise Server performs the following tasks in the START stage:

  • Copy all transactional tables.
    • InnoDB (i.e. ibdataN and file extensions .ibd and .isl)
    • Aria (i.e. aria_log_control and file extensions .MAD and .MAI)
  • Copy the tail of all transaction logs.
    • The tail of the InnoDB redo log (i.e. ib_logfileN files) will be copied for InnoDB tables.
    • The tail of the Aria redo log (i.e. aria_log.N files) will be copied for Aria tables.

BACKUP STAGE FLUSH in MariaDB Enterprise Server

Mariabackup from MariaDB Enterprise Server performs the following tasks in the FLUSH stage:

  • Copy all non-transactional tables that are not in use. This list of used tables is found with SHOW OPEN TABLES.
    • MyISAM (i.e. file extensions .MYD and .MYI)
    • MERGE (i.e. file extensions .MRG)
    • ARCHIVE (i.e. file extensions .ARM and .ARZ)
    • CSV (i.e. file extensions .CSM and .CSV)
  • Copy the tail of all transaction logs.
    • The tail of the InnoDB redo log (i.e. ib_logfileN files) will be copied for InnoDB tables.
    • The tail of the Aria redo log (i.e. aria_log.N files) will be copied for Aria tables.

BACKUP STAGE BLOCK_DDL in MariaDB Enterprise Server

Mariabackup from MariaDB Enterprise Server performs the following tasks in the BLOCK_DDL stage:

  • Copy other files.
    • i.e. file extensions .frm, .isl, .TRG, .TRN, .opt, .par
  • Copy the non-transactional tables that were in use during BACKUP STAGE FLUSH.
    • MyISAM (i.e. file extensions .MYD and .MYI)
    • MERGE (i.e. file extensions .MRG)
    • ARCHIVE (i.e. file extensions .ARM and .ARZ)
    • CSV (i.e. file extensions .CSM and .CSV)
  • Check ddl.log for DDL executed before the BLOCK 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.
  • Copy changes to system log tables.
  • Copy the tail of all transaction logs.
    • The tail of the InnoDB redo log (i.e. ib_logfileN files) will be copied for InnoDB tables.
    • The tail of the Aria redo log (i.e. aria_log.N files) will be copied for Aria tables.

BACKUP STAGE BLOCK_COMMIT in MariaDB Enterprise Server

Mariabackup from MariaDB Enterprise Server performs the following tasks in the BLOCK_COMMIT stage:

BACKUP STAGE END in MariaDB Enterprise Server

Mariabackup from MariaDB Enterprise Server performs the following tasks in the END stage:

  • Copy the MyRocks checkpoint into the backup.

Comments

Comments loading...
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.