From 34eef269eb93ee42c0e5e1894781c61f66cb6f14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Fri, 4 Aug 2017 13:57:26 +0300 Subject: MDEV-11939: innochecksum mistakes a file for an encrypted one (page 0 invalid) Always read full page 0 to determine does tablespace contain encryption metadata. Tablespaces that are page compressed or page compressed and encrypted do not compare checksum as it does not exists. For encrypted tables use checksum verification written for encrypted tables and normal tables use normal method. buf_page_is_checksum_valid_crc32 buf_page_is_checksum_valid_innodb buf_page_is_checksum_valid_none Modify Innochecksum logging to file to avoid compilation warnings. fil0crypt.cc fil0crypt.h Modify to be able to use in innochecksum compilation and move fil_space_verify_crypt_checksum to end of the file. Add innochecksum logging to file. univ.i Add innochecksum strict_verify, log_file and cur_page_num variables as extern. page_zip_verify_checksum Add innochecksum logging to file and remove unnecessary code. innochecksum.cc Lot of changes most notable able to read encryption metadata from page 0 of the tablespace. Added test case where we corrupt intentionally FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION (encryption key version) FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION+4 (post encryption checksum) FIL_DATA+10 (data) --- mysql-test/suite/innodb_zip/r/innochecksum_2.result | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'mysql-test/suite/innodb_zip/r/innochecksum_2.result') diff --git a/mysql-test/suite/innodb_zip/r/innochecksum_2.result b/mysql-test/suite/innodb_zip/r/innochecksum_2.result index 78d8a1cbf90..582bb42f0cb 100644 --- a/mysql-test/suite/innodb_zip/r/innochecksum_2.result +++ b/mysql-test/suite/innodb_zip/r/innochecksum_2.result @@ -31,6 +31,7 @@ allow-mismatches 0 write crc32 page-type-summary FALSE page-type-dump MYSQLTEST_VARDIR/tmp/dump.txt +per-page-details FALSE log (No default value) leaf FALSE merge 0 @@ -41,7 +42,7 @@ innochecksum Ver #.#.# Copyright (c) YEAR, YEAR , Oracle, MariaDB Corporation Ab and others. InnoDB offline file checksum utility. -Usage: innochecksum [-c] [-s ] [-e ] [-p ] [-v] [-a ] [-n] [-C ] [-w ] [-S] [-D ] [-l ] [-e] +Usage: innochecksum [-c] [-s ] [-e ] [-p ] [-i] [-v] [-a ] [-n] [-C ] [-w ] [-S] [-D ] [-l ] [-l] [-m ] -?, --help Displays this help and exits. -I, --info Synonym for --help. -V, --version Displays version information and exits. @@ -62,8 +63,10 @@ Usage: innochecksum [-c] [-s ] [-e ] [-p ] [-v] [-a Display a count of each page type in a tablespace. -D, --page-type-dump=name Dump the page type info for each page in a tablespace. + -i, --per-page-details + Print out per-page detail information. -l, --log=name log output. - -e, --leaf Examine leaf index pages + -f, --leaf Examine leaf index pages -m, --merge=# leaf page count if merge given number of consecutive pages @@ -81,6 +84,7 @@ allow-mismatches 0 write crc32 page-type-summary FALSE page-type-dump (No default value) +per-page-details FALSE log (No default value) leaf FALSE merge 0 -- cgit v1.2.1