15.2 Update Operations

There are two types of operations to bring your backup data up-to-date:

Apply-log Operation

After a backup job was first completed, the backup data might not be in a consistent state, because data could have been inserted, updated, or deleted while the backup was running. This initial backup file is known as the raw backup. During a backup, mysqlbackup also copies the accumulated InnoDB log to a file called ibbackup_logfile. In an apply-log operation, the ibbackup_logfile file is used to roll forward the raw data files, so that every page in the data files corresponds to the same log sequence number of the InnoDB log. This is similar to the operation that takes place during a crash recovery.

For single-file backups, the apply-log operation is usually performed as part of the copy-back-and-apply-log command. For directory backups, the copy-back-and-apply-log command can also be used, but you also have the two alternatives of

  • Performing the apply-log operation together with the back up using the backup-and-apply-log command (not applicable for incremental or compressed directory backups)

  • Performing the apply-log operation separately with the apply-log command on the raw backup, before running the copy-back command.

mysqlbackup [STD-OPTIONS]
            [--limit-memory=MB] [--uncompress] [--backup-dir=PATH]
  • apply-log

    Advanced: Brings the InnoDB tables in the directory backup up-to-date, including any changes made to the data while the backup was running.

Example 15.1 Apply Log to Full Backup

mysqlbackup --backup-dir=/path/to/backup apply-log

It reads the backup-my.cnf file inside backup-dir to understand the backup. The my.cnf defaults files have no effect other than supplying the limit-memory=MB value, which limits usage of memory while doing the apply-log operation.

Apply-incremental-backup Operation

Advanced: Use the apply-incremental-backup to update a backup directory with data in an incremental backup directory:

mysqlbackup [STD-OPTIONS]
            [--incremental-backup-dir=PATH] [--backup-dir=PATH]
            [--limit-memory=MB] [--uncompress]