XtraDB changed page tracking¶
XtraDB now tracks the pages that have changes written to them according to the redo log. This information is written out in special changed page bitmap files. This information can be used to speed up incremental backups using Percona XtraBackup by removing the need to scan whole data files to find the changed pages. Changed page tracking is done by a new XtraDB worker thread that reads and parses log records between checkpoints. The tracking is controlled by a new read-only server variable
Bitmap filename format used for changed page tracking is
ib_modified_log_<seq>_<startlsn>.xdb. The first number is the sequence number of the bitmap log file and the startlsn number is the starting LSN number of data tracked in that file. Example of the bitmap log files should look like this:
Sequence number can be used to easily check if all the required bitmap files are present. Start LSN number will be used in XtraBackup and
INFORMATION_SCHEMA queries to determine which files have to be opened and read for the required LSN interval data. The bitmap file is rotated on each server restart and whenever the current file size reaches the predefined maximum. This maximum is controlled by a new
Old bitmap files may be safely removed after a corresponding incremental backup is taken. For that there are server User statements for handling the XtraDB changed page bitmaps. Removing the bitmap files from the filesystem directly is safe too, as long as care is taken not to delete data for not-yet-backuped LSN range.
This feature will be used for implementing faster incremental backups that use this information to avoid full data scans in Percona XtraBackup.
User statements for handling the XtraDB changed page bitmaps¶
New statements have been introduced for handling the changed page bitmap tracking. All of these statements require
FLUSH CHANGED_PAGE_BITMAPS- this statement can be used for synchronous bitmap write for immediate catch-up with the log checkpoint. This is used by innobackupex to make sure that XtraBackup indeed has all the required data it needs.
RESET CHANGED_PAGE_BITMAPS- this statement will delete all the bitmap log files and restart the bitmap log file sequence.
PURGE CHANGED_PAGE_BITMAPS BEFORE <lsn>- this statement will delete all the change page bitmap files up to the specified log sequence number.
Additional information in SHOW ENGINE INNODB STATUS¶
When log tracking is enabled, the following additional fields are displayed in the LOG section of the
SHOW ENGINE INNODB STATUS output:
- “Log tracked up to:” displays the LSN up to which all the changes have been parsed and stored as a bitmap on disk by the log tracking thread
- “Max tracked LSN age:” displays the maximum limit on how far behind the log tracking thread may be.
Implemented in Percona Server for MySQL 8.0.13-4, a new InnoDB monitor, log_writer_on_tracker_waits, records log writer waits due to changed page tracking lag. This log writer works in parallel with other log_writer_on_[*]_ waits monitors.
This table contains a list of modified pages from the bitmap file data. As these files are generated by the log tracking thread parsing the log whenever the checkpoint is made, it is not real-time data.
- space_id (INT(11)) – space id of modified page
- page_id (INT(11)) – id of modified page
- start_lsn (BIGINT(21)) – start of the interval
- end_lsn (BIGINT(21)) – end of the interval
start_lsn and the
end_lsn columns denote between which two checkpoints this page was changed at least once. They are also equal to checkpoint LSNs.
Number of records in this table can be limited by using the variable
Version Specific Information¶
- Feature ported from Percona Server for MySQL 5.7.
Command Line: Yes Config File: Yes Scope: Global Dynamic: Yes Variable Type: Numeric Default Value: 1000000 Range: 1 - 0 (unlimited)
This variable is used to limit the result row count for the queries from
Command Line: Yes Config File: Yes Scope: Global Dynamic: No Variable Type: Boolean Default Value: 0 - False Range: 0-1
This variable is used to enable/disable XtraDB changed page tracking feature.
Command Line: Yes Config File: Yes Scope: Global Dynamic: Yes Variable Type: Numeric Default Value: 104857600 (100 MB) Range: 4096 (4KB) - 18446744073709551615 (16EB)
This variable is used to control maximum bitmap size after which the file will be rotated.