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 innodb_track_changed_pages.

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:

ib_modified_log_1_0.xdb
ib_modified_log_2_1603391.xdb

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 innodb_max_bitmap_file_size variable.

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

In Percona Server 5.5.29-30.0 new statements have been introduced for handling the changed page bitmap tracking. All of these statements require SUPER privilege.

  • 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.

INFORMATION_SCHEMA Tables

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.

table INFORMATION_SCHEMA.INNODB_CHANGED_PAGES
Columns:
  • 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

The 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 innodb_max_changed_pages.

System Variables

variable innodb_max_changed_pages
Version Info:
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 INNODB_CHANGED_PAGES table.

variable innodb_track_changed_pages
Version Info:
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.

variable innodb_max_bitmap_file_size
Version Info:
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.

© Copyright Percona LLC and/or its affiliates 2009-2014.
Except where otherwise noted, this documentation is licensed under the following license:
CC Attribution-ShareAlike 2.0 Generic
Created using Sphinx 1.2.2.
This documentation is developed in Launchpad as part of the Percona Server source code.
If you spotted innacuracies, errors, don't understood it or you think something is missing or should be improved, please file a bug.