mirror of
https://github.com/MariaDB/server.git
synced 2025-12-10 19:44:09 +03:00
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)
161 lines
6.0 KiB
Plaintext
161 lines
6.0 KiB
Plaintext
SET GLOBAL innodb_compression_level=0;
|
|
SELECT @@innodb_compression_level;
|
|
@@innodb_compression_level
|
|
0
|
|
CREATE TABLE t1 (j LONGBLOB) ENGINE = InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
|
|
INSERT INTO t1 VALUES (repeat('abcdefghijklmnopqrstuvwxyz',200));
|
|
INSERT INTO t1 SELECT * from t1;
|
|
INSERT INTO t1 SELECT * from t1;
|
|
INSERT INTO t1 SELECT * from t1;
|
|
INSERT INTO t1 SELECT * from t1;
|
|
INSERT INTO t1 SELECT * from t1;
|
|
INSERT INTO t1 SELECT * from t1;
|
|
INSERT INTO t1 SELECT * from t1;
|
|
INSERT INTO t1 SELECT * from t1;
|
|
INSERT INTO t1 SELECT * from t1;
|
|
INSERT INTO t1 SELECT * from t1;
|
|
# stop the server
|
|
|
|
Variables (--variable-name=value)
|
|
and boolean options {FALSE|TRUE} Value (after reading options)
|
|
--------------------------------- ----------------------------------------
|
|
verbose TRUE
|
|
debug FALSE
|
|
count FALSE
|
|
start-page 0
|
|
end-page 0
|
|
page 0
|
|
strict-check crc32
|
|
no-check FALSE
|
|
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
|
|
[1]:# check the both short and long options for "help"
|
|
[2]:# Run the innochecksum when file isn't provided.
|
|
# It will print the innochecksum usage similar to --help option.
|
|
innochecksum Ver #.#.#
|
|
Copyright (c) YEAR, YEAR , Oracle, MariaDB Corporation Ab and others.
|
|
|
|
InnoDB offline file checksum utility.
|
|
Usage: innochecksum [-c] [-s <start page>] [-e <end page>] [-p <page>] [-i] [-v] [-a <allow mismatches>] [-n] [-C <strict-check>] [-w <write>] [-S] [-D <page type dump>] [-l <log>] [-l] [-m <merge pages>] <filename or [-]>
|
|
-?, --help Displays this help and exits.
|
|
-I, --info Synonym for --help.
|
|
-V, --version Displays version information and exits.
|
|
-v, --verbose Verbose (prints progress every 5 seconds).
|
|
-c, --count Print the count of pages in the file and exits.
|
|
-s, --start-page=# Start on this page number (0 based).
|
|
-e, --end-page=# End at this page number (0 based).
|
|
-p, --page=# Check only this page (0 based).
|
|
-C, --strict-check=name
|
|
Specify the strict checksum algorithm by the user.. One
|
|
of: crc32, crc32, innodb, innodb, none, none
|
|
-n, --no-check Ignore the checksum verification.
|
|
-a, --allow-mismatches=#
|
|
Maximum checksum mismatch allowed.
|
|
-w, --write=name Rewrite the checksum algorithm by the user.. One of:
|
|
crc32, crc32, innodb, innodb, none, none
|
|
-S, --page-type-summary
|
|
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.
|
|
-f, --leaf Examine leaf index pages
|
|
-m, --merge=# leaf page count if merge given number of consecutive
|
|
pages
|
|
|
|
Variables (--variable-name=value)
|
|
and boolean options {FALSE|TRUE} Value (after reading options)
|
|
--------------------------------- ----------------------------------------
|
|
verbose FALSE
|
|
count FALSE
|
|
start-page 0
|
|
end-page 0
|
|
page 0
|
|
strict-check crc32
|
|
no-check FALSE
|
|
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
|
|
[3]:# check the both short and long options for "count" and exit
|
|
Number of pages:#
|
|
Number of pages:#
|
|
[4]:# Print the version of innochecksum and exit
|
|
innochecksum Ver #.#.## Restart the DB server
|
|
DROP TABLE t1;
|
|
[5]:# Check the innochecksum for compressed table t1 with different key_block_size
|
|
# Test for KEY_BLOCK_SIZE=1
|
|
===> Testing size=1
|
|
CREATE TABLE t1(id INT AUTO_INCREMENT PRIMARY KEY, msg VARCHAR(255)) ENGINE=INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
|
|
insert into t1 values(1,"I");
|
|
insert into t1 values(2,"AM");
|
|
insert into t1 values(3,"COMPRESSED");
|
|
select * from t1;
|
|
id msg
|
|
1 I
|
|
2 AM
|
|
3 COMPRESSED
|
|
drop table t1;
|
|
# Test for KEY_BLOCK_SIZE=2
|
|
===> Testing size=2
|
|
CREATE TABLE t1(id INT AUTO_INCREMENT PRIMARY KEY, msg VARCHAR(255)) ENGINE=INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2;
|
|
insert into t1 values(1,"I");
|
|
insert into t1 values(2,"AM");
|
|
insert into t1 values(3,"COMPRESSED");
|
|
select * from t1;
|
|
id msg
|
|
1 I
|
|
2 AM
|
|
3 COMPRESSED
|
|
drop table t1;
|
|
# Test for for KEY_BLOCK_SIZE=4
|
|
===> Testing size=4
|
|
CREATE TABLE t1(id INT AUTO_INCREMENT PRIMARY KEY, msg VARCHAR(255)) ENGINE=INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
|
|
insert into t1 values(1,"I");
|
|
insert into t1 values(2,"AM");
|
|
insert into t1 values(3,"COMPRESSED");
|
|
select * from t1;
|
|
id msg
|
|
1 I
|
|
2 AM
|
|
3 COMPRESSED
|
|
drop table t1;
|
|
set innodb_strict_mode=off;
|
|
# Test for for KEY_BLOCK_SIZE=8
|
|
===> Testing size=8
|
|
CREATE TABLE t1(id INT AUTO_INCREMENT PRIMARY KEY, msg VARCHAR(255)) ENGINE=INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;
|
|
insert into t1 values(1,"I");
|
|
insert into t1 values(2,"AM");
|
|
insert into t1 values(3,"COMPRESSED");
|
|
select * from t1;
|
|
id msg
|
|
1 I
|
|
2 AM
|
|
3 COMPRESSED
|
|
drop table t1;
|
|
set innodb_strict_mode=off;
|
|
# Test for KEY_BLOCK_SIZE=16
|
|
===> Testing size=16
|
|
CREATE TABLE t1(id INT AUTO_INCREMENT PRIMARY KEY, msg VARCHAR(255)) ENGINE=INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=16;
|
|
insert into t1 values(1,"I");
|
|
insert into t1 values(2,"AM");
|
|
insert into t1 values(3,"COMPRESSED");
|
|
select * from t1;
|
|
id msg
|
|
1 I
|
|
2 AM
|
|
3 COMPRESSED
|
|
drop table t1;
|
|
# Test[5] completed
|