innochecksum

You are viewing an old version of this article. View the current version here.

innochecksum is a tool for printing checksums for InnoDB files.

Usage

innochecksum [options] file_name

Description

It reads an InnoDB tablespace file, calculates the checksum for each page, compares the calculated checksum to the stored checksum, and reports mismatches, which indicate damaged pages. It was originally developed to speed up verifying the integrity of tablespace files after power outages but can also be used after file copies. Because checksum mismatches will cause InnoDB to deliberately shut down a running server, it can be preferable to use innochecksum rather than waiting for a server in production usage to encounter the damaged pages.

Multiple filenames can be specified by a wildcard on non-Windows systems only.

innochecksum works with compressed pages, and also includes options to analyze leaf pages to estimate how fragmented an index is and how much benefit can be gained from defragmentation.

innochecksum cannot be used on tablespace files that the server already has open. For such files, you should use CHECK TABLE to check tables within the tablespace. If checksum mismatches are found, you would normally restore the tablespace from backup or start the server and attempt to use mariadb-dump to make a backup of the tables within the tablespace.

Options

innochecksum supports the following options. For options that refer to page numbers, the numbers are zero-based.

OptionDescription
-a, --allow-mismatches=#Maximum checksum mismatch allowed before innochecksum terminates. Defaults to 0, which terminates on the first mismatch.
-c, --countPrint a count of the number of pages in the file.
-e num, --end-page=#End at this page number (0-based).
-?, --helpDisplays help and exits.
-I, --infoSynonym for --help.
-f, --leafExamine leaf index pages. Until MariaDB 10.2.4, the short code was -l, but this was changed to avoid confusion with the --log option.
-l fn, --log=fnLog output to the specified filename fn.
-m num, --merge=#Leaf page count if merge given number of consecutive pages.
-n, --no-checkIgnore the checksum verification. Until MariaDB 10.6, must be used with the --write option.
-p num, --page=#Check only this page number (0-based).
-D, --page-type-dump=nameDump the page type info for each page in a tablespace.
-S, --page-type-summaryDisplay a count of each page type in a tablespace
-i, --per-page-detailsPrint out per-page detail information.
-u, --skip-corruptSkip corrupt pages.
-s num, --start-page=#Start at this page number (0-based).
-C, --strict-check=nameSpecify the strict checksum algorithm. One of: crc32, innodb, none. If not specified, validates against innodb, crc32 and none. full_crc32 is not supported. See also innodb_checksum_algorithm. Removed in MariaDB 10.6.0
-v, --verboseVerbose mode; print a progress indicator every five seconds.
-V, --versionDisplays version information and exits.
-w, --write=nameRewrite the checksum algorithm. One of crc32, innodb, none. An exclusive lock is obtained during use. Use in conjunction with the -no-check option to rewrite an invalid checksum. Removed in MariaDB 10.6.0

Examples

Rewriting a crc32 checksum to replace an invalid checksum:

innochecksum --no-check --write crc32 tablename.ibd

A count of each page type:

innochecksum --page-type-summary data/mysql/gtid_slave_pos.ibd

File::data/mysql/gtid_slave_pos.ibd
================PAGE TYPE SUMMARY==============
#PAGE_COUNT	PAGE_TYPE
===============================================
       1	Index page
       0	Undo log page
       1	Inode page
       0	Insert buffer free list page
       2	Freshly allocated page
       1	Insert buffer bitmap
       0	System page
       0	Transaction system page
       1	File Space Header
       0	Extent descriptor page
       0	BLOB page
       0	Compressed BLOB page
       0	Page compressed page
       0	Page compressed encrypted page
       0	Other type of page

===============================================
Additional information:
Undo page type: 0 insert, 0 update, 0 other
Undo page state: 0 active, 0 cached, 0 to_free, 0 to_purge, 0 prepared, 0 other
index_id	#pages		#leaf_pages	#recs_per_page	#bytes_per_page
24		1		1		0		0

index_id	page_data_bytes_histgram(empty,...,oversized)
24		1	0	0	0	0	0	0	0	0	0	0	0

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.