Commit 737295c7 authored by Jan Lindström's avatar Jan Lindström

MDEV-10727: Merge 5.7 Innochecksum with 5.6

parent b3f7d52e
This diff is collapsed.
...@@ -13,5 +13,4 @@ ...@@ -13,5 +13,4 @@
innodb_scrub : MDEV-8139 innodb_scrub : MDEV-8139
innodb_scrub_compressed : MDEV-8139 innodb_scrub_compressed : MDEV-8139
innodb_scrub_background : MDEV-8139 innodb_scrub_background : MDEV-8139
innochecksum : MDEV-10727
innodb_encryption_discard_import : MDEV-9099 innodb_encryption_discard_import : MDEV-9099
SET GLOBAL innodb_file_format = `Barracuda`; SET GLOBAL innodb_file_format = `Barracuda`;
Warnings:
Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
SET GLOBAL innodb_file_per_table = ON; SET GLOBAL innodb_file_per_table = ON;
set global innodb_compression_algorithm = 1; set global innodb_compression_algorithm = 1;
# Create and populate a tables # Create and populate a tables
...@@ -21,3 +23,5 @@ CREATE TABLE t5 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT) ENGINE=InnoDB PAGE_CO ...@@ -21,3 +23,5 @@ CREATE TABLE t5 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT) ENGINE=InnoDB PAGE_CO
# Write file to make mysql-test-run.pl start up the server again # Write file to make mysql-test-run.pl start up the server again
# Cleanup # Cleanup
DROP TABLE t1, t2, t3, t4, t5; DROP TABLE t1, t2, t3, t4, t5;
Warnings:
Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
...@@ -17,6 +17,7 @@ if (!$INNOCHECKSUM) { ...@@ -17,6 +17,7 @@ if (!$INNOCHECKSUM) {
let $innodb_compression_algorithm_orig=`SELECT @@innodb_compression_algorithm`; let $innodb_compression_algorithm_orig=`SELECT @@innodb_compression_algorithm`;
let $innodb_file_format_orig = `SELECT @@innodb_file_format`; let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`; let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
let MYSQLD_DATADIR= `SELECT @@datadir`;
--enable_query_log --enable_query_log
SET GLOBAL innodb_file_format = `Barracuda`; SET GLOBAL innodb_file_format = `Barracuda`;
......
...@@ -11,16 +11,20 @@ insert into t1 values(2,"am"); ...@@ -11,16 +11,20 @@ insert into t1 values(2,"am");
insert into t1 values(3,"compressed table"); insert into t1 values(3,"compressed table");
# Shutdown the Server # Shutdown the Server
# Server Default checksum = innodb # Server Default checksum = innodb
[1a]: check the innochecksum when file doesn't exists
[1b]: check the innochecksum without --strict-check [1b]: check the innochecksum without --strict-check
[2]: check the innochecksum with full form --strict-check=crc32 [2]: check the innochecksum with full form --strict-check=crc32
[3]: check the innochecksum with short form -C crc32 [3]: check the innochecksum with short form -C crc32
[4]: check the innochecksum with --no-check ignores algorithm check, warning is expected [4]: check the innochecksum with --no-check ignores algorithm check, warning is expected
FOUND /Error: --no-check must be associated with --write option./ in my_restart.err
[5]: check the innochecksum with short form --no-check ignores algorithm check, warning is expected [5]: check the innochecksum with short form --no-check ignores algorithm check, warning is expected
FOUND /Error: --no-check must be associated with --write option./ in my_restart.err
[6]: check the innochecksum with full form strict-check & no-check , an error is expected [6]: check the innochecksum with full form strict-check & no-check , an error is expected
FOUND /Error: --strict-check option cannot be used together with --no-check option./ in my_restart.err
[7]: check the innochecksum with short form strict-check & no-check , an error is expected [7]: check the innochecksum with short form strict-check & no-check , an error is expected
FOUND /Error: --strict-check option cannot be used together with --no-check option./ in my_restart.err
[8]: check the innochecksum with short & full form combination [8]: check the innochecksum with short & full form combination
# strict-check & no-check, an error is expected # strict-check & no-check, an error is expected
FOUND /Error: --strict-check option cannot be used together with --no-check option./ in my_restart.err
[9]: check the innochecksum with full form --strict-check=innodb [9]: check the innochecksum with full form --strict-check=innodb
[10]: check the innochecksum with full form --strict-check=none [10]: check the innochecksum with full form --strict-check=none
# when server Default checksum=crc32 # when server Default checksum=crc32
...@@ -29,12 +33,21 @@ insert into t1 values(3,"compressed table"); ...@@ -29,12 +33,21 @@ insert into t1 values(3,"compressed table");
[12]: check the innochecksum with short form -C none [12]: check the innochecksum with short form -C none
# when server Default checksum=crc32 # when server Default checksum=crc32
[13]: check strict-check with invalid values [13]: check strict-check with invalid values
FOUND /Error while setting value \'strict_innodb\' to \'strict-check\'/ in my_restart.err
FOUND /Error while setting value \'strict_innodb\' to \'strict-check\'/ in my_restart.err
FOUND /Error while setting value \'strict_crc32\' to \'strict-check\'/ in my_restart.err
FOUND /Error while setting value \'strict_crc32\' to \'strict-check\'/ in my_restart.err
FOUND /Error while setting value \'strict_none\' to \'strict-check\'/ in my_restart.err
FOUND /Error while setting value \'strict_none\' to \'strict-check\'/ in my_restart.err
FOUND /Error while setting value \'InnoBD\' to \'strict-check\'/ in my_restart.err
FOUND /Error while setting value \'InnoBD\' to \'strict-check\'/ in my_restart.err
FOUND /Error while setting value \'crc\' to \'strict-check\'/ in my_restart.err
FOUND /Error while setting value \'no\' to \'strict-check\'/ in my_restart.err
[14a]: when server default checksum=crc32 rewrite new checksum=crc32 with innochecksum [14a]: when server default checksum=crc32 rewrite new checksum=crc32 with innochecksum
# Also check the long form of write option. # Also check the long form of write option.
[14b]: when server default checksum=crc32 rewrite new checksum=innodb with innochecksum [14b]: when server default checksum=crc32 rewrite new checksum=innodb with innochecksum
# Also check the long form of write option. # Also check the long form of write option.
# start the server with innodb_checksum_algorithm=InnoDB # start the server with innodb_checksum_algorithm=InnoDB
# restart
INSERT INTO tab1 VALUES(2, 'Innochecksum CRC32'); INSERT INTO tab1 VALUES(2, 'Innochecksum CRC32');
SELECT c1,c2 FROM tab1 order by c1,c2; SELECT c1,c2 FROM tab1 order by c1,c2;
c1 c2 c1 c2
...@@ -44,7 +57,6 @@ c1 c2 ...@@ -44,7 +57,6 @@ c1 c2
[15]: when server default checksum=crc32 rewrite new checksum=none with innochecksum [15]: when server default checksum=crc32 rewrite new checksum=none with innochecksum
# Also check the short form of write option. # Also check the short form of write option.
# Start the server with checksum algorithm=none # Start the server with checksum algorithm=none
# restart
INSERT INTO tab1 VALUES(3, 'Innochecksum None'); INSERT INTO tab1 VALUES(3, 'Innochecksum None');
SELECT c1,c2 FROM tab1 order by c1,c2; SELECT c1,c2 FROM tab1 order by c1,c2;
c1 c2 c1 c2
...@@ -55,7 +67,6 @@ DROP TABLE t1; ...@@ -55,7 +67,6 @@ DROP TABLE t1;
# Stop the server # Stop the server
[16]: rewrite into new checksum=crc32 with innochecksum [16]: rewrite into new checksum=crc32 with innochecksum
# Restart the DB server with innodb_checksum_algorithm=crc32 # Restart the DB server with innodb_checksum_algorithm=crc32
# restart
SELECT * FROM tab1; SELECT * FROM tab1;
c1 c2 c1 c2
1 Innochecksum InnoDB1 1 Innochecksum InnoDB1
...@@ -69,14 +80,15 @@ c1 c2 ...@@ -69,14 +80,15 @@ c1 c2
# Stop server # Stop server
[17]: rewrite into new checksum=InnoDB [17]: rewrite into new checksum=InnoDB
# Restart the DB server with innodb_checksum_algorithm=InnoDB # Restart the DB server with innodb_checksum_algorithm=InnoDB
# restart
DELETE FROM tab1 where c1=2; DELETE FROM tab1 where c1=2;
SELECT * FROM tab1; SELECT * FROM tab1;
c1 c2 c1 c2
1 Innochecksum InnoDB1 1 Innochecksum InnoDB1
# Stop server # Stop server
[18]:check Innochecksum with invalid write options [18]:check Innochecksum with invalid write options
FOUND /Error while setting value \'strict_crc32\' to \'write\'/ in my_restart.err
FOUND /Error while setting value \'strict_innodb\' to \'write\'/ in my_restart.err
FOUND /Error while setting value \'crc23\' to \'write\'/ in my_restart.err
# Restart the server # Restart the server
# restart
DROP TABLE tab1; DROP TABLE tab1;
SET GLOBAL innodb_file_per_table=default; SET GLOBAL innodb_file_per_table=default;
...@@ -15,15 +15,30 @@ INSERT INTO t1 SELECT * from t1; ...@@ -15,15 +15,30 @@ 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 # 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 /dev/shm/tmp/dump.txt
log (No default value)
leaf FALSE
merge 0
[1]:# check the both short and long options for "help" [1]:# check the both short and long options for "help"
[2]:# Run the innochecksum when file isn't provided. [2]:# Run the innochecksum when file isn't provided.
# It will print the innochecksum usage similar to --help option. # It will print the innochecksum usage similar to --help option.
innochecksum Ver #.#.# innochecksum Ver #.#.#
Copyright (c) YEAR, YEAR , Oracle and/or its affiliates. All rights reserved. Copyright (c) YEAR, YEAR , Oracle, MariaDB Corporation Ab and others.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
InnoDB offline file checksum utility. InnoDB offline file checksum utility.
Usage: innochecksum [-c] [-s <start page>] [-e <end page>] [-p <page>] [-v] [-a <allow mismatches>] [-n] [-C <strict-check>] [-w <write>] [-S] [-D <page type dump>] [-l <log>] <filename or [-]> Usage: innochecksum [-c] [-s <start page>] [-e <end page>] [-p <page>] [-v] [-a <allow mismatches>] [-n] [-C <strict-check>] [-w <write>] [-S] [-D <page type dump>] [-l <log>] <filename or [-]>
...@@ -36,16 +51,21 @@ Usage: innochecksum [-c] [-s <start page>] [-e <end page>] [-p <page>] [-v] [-a ...@@ -36,16 +51,21 @@ Usage: innochecksum [-c] [-s <start page>] [-e <end page>] [-p <page>] [-v] [-a
-e, --end-page=# End at this page number (0 based). -e, --end-page=# End at this page number (0 based).
-p, --page=# Check only this page (0 based). -p, --page=# Check only this page (0 based).
-C, --strict-check=name -C, --strict-check=name
Specify the strict checksum algorithm by the user. Specify the strict checksum algorithm by the user.. One
of: crc32, crc32, innodb, innodb, none, none
-n, --no-check Ignore the checksum verification. -n, --no-check Ignore the checksum verification.
-a, --allow-mismatches=# -a, --allow-mismatches=#
Maximum checksum mismatch allowed. Maximum checksum mismatch allowed.
-w, --write=name Rewrite the checksum algorithm by the user. -w, --write=name Rewrite the checksum algorithm by the user.. One of:
crc32, crc32, innodb, innodb, none, none
-S, --page-type-summary -S, --page-type-summary
Display a count of each page type in a tablespace. Display a count of each page type in a tablespace.
-D, --page-type-dump=name -D, --page-type-dump=name
Dump the page type info for each page in a tablespace. Dump the page type info for each page in a tablespace.
-l, --log=name log output. -l, --log=name log output.
-l, --leaf Examine leaf index pages
-m, --merge=# leaf page count if merge given number of consecutive
pages
Variables (--variable-name=value) Variables (--variable-name=value)
and boolean options {FALSE|TRUE} Value (after reading options) and boolean options {FALSE|TRUE} Value (after reading options)
...@@ -62,12 +82,13 @@ write crc32 ...@@ -62,12 +82,13 @@ write crc32
page-type-summary FALSE page-type-summary FALSE
page-type-dump (No default value) page-type-dump (No default value)
log (No default value) log (No default value)
leaf FALSE
merge 0
[3]:# check the both short and long options for "count" and exit [3]:# check the both short and long options for "count" and exit
Number of pages:# Number of pages:#
Number of pages:# Number of pages:#
[4]:# Print the version of innochecksum and exit [4]:# Print the version of innochecksum and exit
innochecksum Ver #.#.## Restart the DB server innochecksum Ver #.#.## Restart the DB server
# restart
DROP TABLE t1; DROP TABLE t1;
[5]:# Check the innochecksum for compressed table t1 with different key_block_size [5]:# Check the innochecksum for compressed table t1 with different key_block_size
# Test for KEY_BLOCK_SIZE=1 # Test for KEY_BLOCK_SIZE=1
...@@ -76,7 +97,6 @@ CREATE TABLE t1(id INT AUTO_INCREMENT PRIMARY KEY, msg VARCHAR(255)) ENGINE=INNO ...@@ -76,7 +97,6 @@ CREATE TABLE t1(id INT AUTO_INCREMENT PRIMARY KEY, msg VARCHAR(255)) ENGINE=INNO
insert into t1 values(1,"I"); insert into t1 values(1,"I");
insert into t1 values(2,"AM"); insert into t1 values(2,"AM");
insert into t1 values(3,"COMPRESSED"); insert into t1 values(3,"COMPRESSED");
# restart
select * from t1; select * from t1;
id msg id msg
1 I 1 I
...@@ -89,7 +109,6 @@ CREATE TABLE t1(id INT AUTO_INCREMENT PRIMARY KEY, msg VARCHAR(255)) ENGINE=INNO ...@@ -89,7 +109,6 @@ CREATE TABLE t1(id INT AUTO_INCREMENT PRIMARY KEY, msg VARCHAR(255)) ENGINE=INNO
insert into t1 values(1,"I"); insert into t1 values(1,"I");
insert into t1 values(2,"AM"); insert into t1 values(2,"AM");
insert into t1 values(3,"COMPRESSED"); insert into t1 values(3,"COMPRESSED");
# restart
select * from t1; select * from t1;
id msg id msg
1 I 1 I
...@@ -102,7 +121,6 @@ CREATE TABLE t1(id INT AUTO_INCREMENT PRIMARY KEY, msg VARCHAR(255)) ENGINE=INNO ...@@ -102,7 +121,6 @@ CREATE TABLE t1(id INT AUTO_INCREMENT PRIMARY KEY, msg VARCHAR(255)) ENGINE=INNO
insert into t1 values(1,"I"); insert into t1 values(1,"I");
insert into t1 values(2,"AM"); insert into t1 values(2,"AM");
insert into t1 values(3,"COMPRESSED"); insert into t1 values(3,"COMPRESSED");
# restart
select * from t1; select * from t1;
id msg id msg
1 I 1 I
...@@ -116,7 +134,6 @@ CREATE TABLE t1(id INT AUTO_INCREMENT PRIMARY KEY, msg VARCHAR(255)) ENGINE=INNO ...@@ -116,7 +134,6 @@ CREATE TABLE t1(id INT AUTO_INCREMENT PRIMARY KEY, msg VARCHAR(255)) ENGINE=INNO
insert into t1 values(1,"I"); insert into t1 values(1,"I");
insert into t1 values(2,"AM"); insert into t1 values(2,"AM");
insert into t1 values(3,"COMPRESSED"); insert into t1 values(3,"COMPRESSED");
# restart
select * from t1; select * from t1;
id msg id msg
1 I 1 I
...@@ -130,7 +147,6 @@ CREATE TABLE t1(id INT AUTO_INCREMENT PRIMARY KEY, msg VARCHAR(255)) ENGINE=INNO ...@@ -130,7 +147,6 @@ CREATE TABLE t1(id INT AUTO_INCREMENT PRIMARY KEY, msg VARCHAR(255)) ENGINE=INNO
insert into t1 values(1,"I"); insert into t1 values(1,"I");
insert into t1 values(2,"AM"); insert into t1 values(2,"AM");
insert into t1 values(3,"COMPRESSED"); insert into t1 values(3,"COMPRESSED");
# restart
select * from t1; select * from t1;
id msg id msg
1 I 1 I
......
...@@ -39,7 +39,6 @@ SELECT * FROM tab2 ORDER BY col_7; ...@@ -39,7 +39,6 @@ SELECT * FROM tab2 ORDER BY col_7;
# stop the server # stop the server
[1(a)]: Rewrite into new checksum=InnoDB for all *.ibd file and ibdata1 [1(a)]: Rewrite into new checksum=InnoDB for all *.ibd file and ibdata1
: start the server with innodb_checksum_algorithm=strict_innodb : start the server with innodb_checksum_algorithm=strict_innodb
# restart
INSERT INTO tab1 (pk, linestring_key, linestring_nokey) INSERT INTO tab1 (pk, linestring_key, linestring_nokey)
VALUES (2, ST_GeomFromText('LINESTRING(10 10,20 20,30 30)'), ST_GeomFromText('LINESTRING(10 10,20 20,30 30)')); VALUES (2, ST_GeomFromText('LINESTRING(10 10,20 20,30 30)'), ST_GeomFromText('LINESTRING(10 10,20 20,30 30)'));
SET @col_1 = repeat('a', 5); SET @col_1 = repeat('a', 5);
...@@ -56,7 +55,6 @@ SELECT * FROM tab2 ORDER BY col_7; ...@@ -56,7 +55,6 @@ SELECT * FROM tab2 ORDER BY col_7;
# stop the server # stop the server
[1(b)]: Rewrite into new checksum=crc32 for all *.ibd file and ibdata1 [1(b)]: Rewrite into new checksum=crc32 for all *.ibd file and ibdata1
# start the server with innodb_checksum_algorithm=strict_crc32 # start the server with innodb_checksum_algorithm=strict_crc32
# restart
INSERT INTO tab1 (pk, linestring_key, linestring_nokey) INSERT INTO tab1 (pk, linestring_key, linestring_nokey)
VALUES (3, ST_GeomFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))'), VALUES (3, ST_GeomFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))'),
ST_GeomFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))')); ST_GeomFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))'));
...@@ -73,7 +71,6 @@ FROM tab1 ORDER BY pk; ...@@ -73,7 +71,6 @@ FROM tab1 ORDER BY pk;
SELECT * FROM tab2 ORDER BY col_7; SELECT * FROM tab2 ORDER BY col_7;
# stop the server # stop the server
[1(c)]: Rewrite into new checksum=none for all *.ibd file and ibdata1 [1(c)]: Rewrite into new checksum=none for all *.ibd file and ibdata1
# restart: --innodb_checksum_algorithm=strict_none --default_storage_engine=InnoDB
INSERT INTO tab1 (pk, linestring_key, linestring_nokey) INSERT INTO tab1 (pk, linestring_key, linestring_nokey)
VALUES (4, ST_GeomFromText('MULTIPOINT(0 0,5 5,10 10,20 20) '), ST_GeomFromText('MULTIPOINT(0 0,5 5,10 10,20 20) ')); VALUES (4, ST_GeomFromText('MULTIPOINT(0 0,5 5,10 10,20 20) '), ST_GeomFromText('MULTIPOINT(0 0,5 5,10 10,20 20) '));
SET @col_1 = repeat('m', 5); SET @col_1 = repeat('m', 5);
...@@ -106,11 +103,22 @@ File::tab#.ibd ...@@ -106,11 +103,22 @@ File::tab#.ibd
# Extent descriptor page # Extent descriptor page
# BLOB page # BLOB page
# Compressed BLOB page # Compressed BLOB page
# Page compressed page
# Page compressed encrypted page
# Other type of page # Other type of page
=============================================== ===============================================
Additional information: Additional information:
Undo page type: # insert, # update, # other Undo page type: # insert, # update, # other
Undo page state: # active, # cached, # to_free, # to_purge, # prepared, # other Undo page state: # active, # cached, # to_free, # to_purge, # prepared, # other
index_id #pages #leaf_pages #recs_per_page #bytes_per_page
# # # # #
# # # # #
# # # # #
index_id page_data_bytes_histgram(empty,...,oversized)
# # # # # # # # # # # # #
# # # # # # # # # # # # #
# # # # # # # # # # # # #
[3]: Check the page type summary with longform for tab1.ibd [3]: Check the page type summary with longform for tab1.ibd
File::tab#.ibd File::tab#.ibd
...@@ -129,11 +137,22 @@ File::tab#.ibd ...@@ -129,11 +137,22 @@ File::tab#.ibd
# Extent descriptor page # Extent descriptor page
# BLOB page # BLOB page
# Compressed BLOB page # Compressed BLOB page
# Page compressed page
# Page compressed encrypted page
# Other type of page # Other type of page
=============================================== ===============================================
Additional information: Additional information:
Undo page type: # insert, # update, # other Undo page type: # insert, # update, # other
Undo page state: # active, # cached, # to_free, # to_purge, # prepared, # other Undo page state: # active, # cached, # to_free, # to_purge, # prepared, # other
index_id #pages #leaf_pages #recs_per_page #bytes_per_page
# # # # #
# # # # #
# # # # #
index_id page_data_bytes_histgram(empty,...,oversized)
# # # # # # # # # # # # #
# # # # # # # # # # # # #
# # # # # # # # # # # # #
[4]: Page type dump for with longform for tab1.ibd [4]: Page type dump for with longform for tab1.ibd
# Print the contents stored in dump.txt # Print the contents stored in dump.txt
...@@ -145,11 +164,30 @@ Filename::tab#.ibd ...@@ -145,11 +164,30 @@ Filename::tab#.ibd
#:: # | File Space Header | - #:: # | File Space Header | -
#:: # | Insert Buffer Bitmap | - #:: # | Insert Buffer Bitmap | -
#:: # | Inode page | - #:: # | Inode page | -
#:: # | Index page | index id=#, page level=#, No. of records=#, garbage=#, - #:: # | Index page | index id=#, page level=# leaf #, No. of records=#, garbage=#, n_recs=#, -
#:: # | Index page | index id=#, page level=#, No. of records=#, garbage=#, - #:: # | Index page | index id=#, page level=# leaf #, No. of records=#, garbage=#, n_recs=#, -
#:: # | Index page | index id=#, page level=#, No. of records=#, garbage=#, - #:: # | Index page | index id=#, page level=# leaf #, No. of records=#, garbage=#, n_recs=#, -
#:: # | Index page | index id=#, page level=#, No. of records=#, garbage=#, - #:: # | Index page | index id=#, page level=# leaf #, No. of records=#, garbage=#, n_recs=#, -
#:: # | Freshly allocated page | - #:: # | Freshly allocated page | -
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
log (No default value)
leaf FALSE
merge 0
[5]: Page type dump for with shortform for tab1.ibd [5]: Page type dump for with shortform for tab1.ibd
...@@ -160,25 +198,30 @@ Filename::tab#.ibd ...@@ -160,25 +198,30 @@ Filename::tab#.ibd
#:: # | File Space Header | - #:: # | File Space Header | -
#:: # | Insert Buffer Bitmap | - #:: # | Insert Buffer Bitmap | -
#:: # | Inode page | - #:: # | Inode page | -
#:: # | Index page | index id=#, page level=#, No. of records=#, garbage=#, - #:: # | Index page | index id=#, page level=# leaf #, No. of records=#, garbage=#, n_recs=#, -
#:: # | Index page | index id=#, page level=#, No. of records=#, garbage=#, - #:: # | Index page | index id=#, page level=# leaf #, No. of records=#, garbage=#, n_recs=#, -
#:: # | Index page | index id=#, page level=#, No. of records=#, garbage=#, - #:: # | Index page | index id=#, page level=# leaf #, No. of records=#, garbage=#, n_recs=#, -
#:: # | Index page | index id=#, page level=#, No. of records=#, garbage=#, - #:: # | Index page | index id=#, page level=# leaf #, No. of records=#, garbage=#, n_recs=#, -
#:: # | Freshly allocated page | - #:: # | Freshly allocated page | -
[6]: check the valid lower bound values for option [6]: check the valid lower bound values for option
# allow-mismatches,page,start-page,end-page # allow-mismatches,page,start-page,end-page
[7]: check the negative values for option
# allow-mismatches,page,start-page,end-page.
# They will reset to zero for negative values.
# check the invalid lower bound values
[8]: check the valid upper bound values for
# both short and long options "allow-mismatches" and "end-page"
[9]: check the both short and long options "page" and "start-page" when [9]: check the both short and long options "page" and "start-page" when
# seek value is larger than file size. # seek value is larger than file size.
NOT FOUND /Error: Unable to seek to necessary offset: Invalid argument/ in my_restart.err
NOT FOUND /Error: Unable to seek to necessary offset: Invalid argument/ in my_restart.err
NOT FOUND /Error: Unable to seek to necessary offset: Invalid argument/ in my_restart.err
NOT FOUND /Error: Unable to seek to necessary offset: Invalid argument/ in my_restart.err
[34]: check the invalid upper bound values for options, allow-mismatches, end-page, start-page and page. [34]: check the invalid upper bound values for options, allow-mismatches, end-page, start-page and page.
# innochecksum will fail with error code: 1 # innochecksum will fail with error code: 1
NOT FOUND /Incorrect unsigned integer value: '18446744073709551616'/ in my_restart.err
NOT FOUND /Incorrect unsigned integer value: '18446744073709551616'/ in my_restart.err
NOT FOUND /Incorrect unsigned integer value: '18446744073709551616'/ in my_restart.err
NOT FOUND /Incorrect unsigned integer value: '18446744073709551616'/ in my_restart.err
NOT FOUND /Incorrect unsigned integer value: '18446744073709551616'/ in my_restart.err
NOT FOUND /Incorrect unsigned integer value: '18446744073709551616'/ in my_restart.err
NOT FOUND /Incorrect unsigned integer value: '18446744073709551616'/ in my_restart.err
NOT FOUND /Incorrect unsigned integer value: '18446744073709551616'/ in my_restart.err
# Restart the server # Restart the server
# restart: --innodb_checksum_algorithm=strict_none --default_storage_engine=InnoDB
DROP TABLE tab1; DROP TABLE tab1;
DROP TABLE tab2; DROP TABLE tab2;
SET GLOBAL innodb_file_per_table=default; SET GLOBAL innodb_file_per_table=default;
...@@ -11,7 +11,5 @@ ...@@ -11,7 +11,5 @@
############################################################################## ##############################################################################
restart : Not supported by MariaDB 10.2 2/9/2016 jplindst restart : Not supported by MariaDB 10.2 2/9/2016 jplindst
innochecksum : MDEV-10727 2/9/2016 jplindst wl6650 : Not supported by MariaDB 10.2
innochecksum_2 : MDEV-10727 2/9/2016 jplindst
innochecksum_3 : MDEV-10727 2/9/2016 jplindst
wl6560 : MDEV_10727
...@@ -31,11 +31,14 @@ insert into t1 values(3,"compressed table"); ...@@ -31,11 +31,14 @@ insert into t1 values(3,"compressed table");
--source include/shutdown_mysqld.inc --source include/shutdown_mysqld.inc
--echo # Server Default checksum = innodb --echo # Server Default checksum = innodb
--echo [1a]: check the innochecksum when file doesn't exists #
--error 1 # Not repeatable with --parallel= >1
--exec $INNOCHECKSUM $MYSQLD_DATADIR/test/aa.ibd 2> $SEARCH_FILE #
let SEARCH_PATTERN= Error: $MYSQLD_DATADIR/test/aa.ibd cannot be found; #--echo [1a]: check the innochecksum when file doesn't exists
--source include/search_pattern_in_file.inc #--error 1
#--exec $INNOCHECKSUM $MYSQLD_DATADIR/test/aa.ibd 2> $SEARCH_FILE
#let SEARCH_PATTERN= Error: $MYSQLD_DATADIR/test/aa.ibd cannot be found;
#--source include/search_pattern_in_file.inc
--echo [1b]: check the innochecksum without --strict-check --echo [1b]: check the innochecksum without --strict-check
--exec $INNOCHECKSUM $MYSQLD_DATADIR/test/tab1.ibd --exec $INNOCHECKSUM $MYSQLD_DATADIR/test/tab1.ibd
......
...@@ -206,6 +206,7 @@ SELECT * FROM tab2 ORDER BY col_7; ...@@ -206,6 +206,7 @@ SELECT * FROM tab2 ORDER BY col_7;
--remove_file $MYSQLTEST_VARDIR/tmp/page_summary_short.txt --remove_file $MYSQLTEST_VARDIR/tmp/page_summary_short.txt
--remove_file $MYSQLTEST_VARDIR/tmp/page_summary_long.txt --remove_file $MYSQLTEST_VARDIR/tmp/page_summary_long.txt
--echo [4]: Page type dump for with longform for tab1.ibd --echo [4]: Page type dump for with longform for tab1.ibd
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--exec $INNOCHECKSUM --page-type-dump $MYSQLTEST_VARDIR/tmp/dump.txt $MYSQLD_DATADIR/test/tab1.ibd --exec $INNOCHECKSUM --page-type-dump $MYSQLTEST_VARDIR/tmp/dump.txt $MYSQLD_DATADIR/test/tab1.ibd
perl; perl;
...@@ -237,6 +238,7 @@ cat_file $MYSQLTEST_VARDIR/tmp/dump.txt; ...@@ -237,6 +238,7 @@ cat_file $MYSQLTEST_VARDIR/tmp/dump.txt;
--remove_file $MYSQLTEST_VARDIR/tmp/dump.txt --remove_file $MYSQLTEST_VARDIR/tmp/dump.txt
# Page type dump for ibdata1 # Page type dump for ibdata1
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--exec $INNOCHECKSUM -v --page-type-dump $MYSQLTEST_VARDIR/tmp/dump.txt $MYSQLD_DATADIR/ibdata1 --exec $INNOCHECKSUM -v --page-type-dump $MYSQLTEST_VARDIR/tmp/dump.txt $MYSQLD_DATADIR/ibdata1
--file_exists $MYSQLTEST_VARDIR/tmp/dump.txt --file_exists $MYSQLTEST_VARDIR/tmp/dump.txt
--remove_file $MYSQLTEST_VARDIR/tmp/dump.txt --remove_file $MYSQLTEST_VARDIR/tmp/dump.txt
...@@ -283,26 +285,29 @@ cat_file $MYSQLTEST_VARDIR/tmp/dump.txt; ...@@ -283,26 +285,29 @@ cat_file $MYSQLTEST_VARDIR/tmp/dump.txt;
--exec $INNOCHECKSUM --end-page=0 $MYSQLD_DATADIR/test/tab1.ibd --exec $INNOCHECKSUM --end-page=0 $MYSQLD_DATADIR/test/tab1.ibd
--exec $INNOCHECKSUM -e 0 $MYSQLD_DATADIR/test/tab1.ibd --exec $INNOCHECKSUM -e 0 $MYSQLD_DATADIR/test/tab1.ibd
--echo [7]: check the negative values for option #
--echo # allow-mismatches,page,start-page,end-page. # These produce now errors
--echo # They will reset to zero for negative values. #
--echo # check the invalid lower bound values #--echo [7]: check the negative values for option
--exec $INNOCHECKSUM --allow-mismatches=-1 $MYSQLD_DATADIR/test/tab1.ibd #--echo # allow-mismatches,page,start-page,end-page.
--exec $INNOCHECKSUM -a -1 $MYSQLD_DATADIR/test/tab1.ibd #--echo # They will reset to zero for negative values.
--exec $INNOCHECKSUM --page=-1 $MYSQLD_DATADIR/test/tab1.ibd #--echo # check the invalid lower bound values
--exec $INNOCHECKSUM -p -1 $MYSQLD_DATADIR/test/tab1.ibd #--exec $INNOCHECKSUM --allow-mismatches=-1 $MYSQLD_DATADIR/test/tab1.ibd
--exec $INNOCHECKSUM --start-page=-1 $MYSQLD_DATADIR/test/tab1.ibd #--exec $INNOCHECKSUM -a -1 $MYSQLD_DATADIR/test/tab1.ibd
--exec $INNOCHECKSUM -s -1 $MYSQLD_DATADIR/test/tab1.ibd #--exec $INNOCHECKSUM --page=-1 $MYSQLD_DATADIR/test/tab1.ibd
--exec $INNOCHECKSUM --end-page=-1 $MYSQLD_DATADIR/test/tab1.ibd #--exec $INNOCHECKSUM -p -1 $MYSQLD_DATADIR/test/tab1.ibd
--exec $INNOCHECKSUM -e -1 $MYSQLD_DATADIR/test/tab1.ibd #--exec $INNOCHECKSUM --start-page=-1 $MYSQLD_DATADIR/test/tab1.ibd
#--exec $INNOCHECKSUM -s -1 $MYSQLD_DATADIR/test/tab1.ibd
--echo [8]: check the valid upper bound values for #--exec $INNOCHECKSUM --end-page=-1 $MYSQLD_DATADIR/test/tab1.ibd
--echo # both short and long options "allow-mismatches" and "end-page" #--exec $INNOCHECKSUM -e -1 $MYSQLD_DATADIR/test/tab1.ibd
#
--exec $INNOCHECKSUM --allow-mismatches=18446744073709551615 $MYSQLD_DATADIR/test/tab1.ibd #--echo [8]: check the valid upper bound values for
--exec $INNOCHECKSUM -a 18446744073709551615 $MYSQLD_DATADIR/test/tab1.ibd #--echo # both short and long options "allow-mismatches" and "end-page"
--exec $INNOCHECKSUM --end-page=18446744073709551615 $MYSQLD_DATADIR/test/tab1.ibd #
--exec $INNOCHECKSUM -e 18446744073709551615 $MYSQLD_DATADIR/test/tab1.ibd #--exec $INNOCHECKSUM --allow-mismatches=18446744073709551615 $MYSQLD_DATADIR/test/tab1.ibd
#--exec $INNOCHECKSUM -a 18446744073709551615 $MYSQLD_DATADIR/test/tab1.ibd
#--exec $INNOCHECKSUM --end-page=18446744073709551615 $MYSQLD_DATADIR/test/tab1.ibd
#--exec $INNOCHECKSUM -e 18446744073709551615 $MYSQLD_DATADIR/test/tab1.ibd
--echo [9]: check the both short and long options "page" and "start-page" when --echo [9]: check the both short and long options "page" and "start-page" when
--echo # seek value is larger than file size. --echo # seek value is larger than file size.
......
...@@ -89,6 +89,14 @@ fil_get_page_type_name( ...@@ -89,6 +89,14 @@ fil_get_page_type_name(
return (const char*)"ZBLOB2"; return (const char*)"ZBLOB2";
case FIL_PAGE_COMPRESSED: case FIL_PAGE_COMPRESSED:
return (const char*)"ORACLE PAGE COMPRESSED"; return (const char*)"ORACLE PAGE COMPRESSED";
case FIL_PAGE_ENCRYPTED:
return (const char*)"ORACLE PAGE ENCRYPTED";
case FIL_PAGE_COMPRESSED_AND_ENCRYPTED:
return (const char*)"ORACLE PAGE COMPRESSED AND ENCRYPTED";
case FIL_PAGE_ENCRYPTED_RTREE:
return (const char*)"ORACLE RTREE ENCRYPTED";
case FIL_PAGE_TYPE_UNKNOWN:
return (const char*)"OLD UNKOWN PAGE TYPE";
default: default:
return (const char*)"PAGE TYPE CORRUPTED"; return (const char*)"PAGE TYPE CORRUPTED";
} }
...@@ -133,7 +141,12 @@ fil_page_type_validate( ...@@ -133,7 +141,12 @@ fil_page_type_validate(
page_type == FIL_PAGE_TYPE_XDES || page_type == FIL_PAGE_TYPE_XDES ||
page_type == FIL_PAGE_TYPE_BLOB || page_type == FIL_PAGE_TYPE_BLOB ||
page_type == FIL_PAGE_TYPE_ZBLOB || page_type == FIL_PAGE_TYPE_ZBLOB ||
page_type == FIL_PAGE_COMPRESSED))) { page_type == FIL_PAGE_TYPE_ZBLOB2 ||
page_type == FIL_PAGE_COMPRESSED ||
page_type == FIL_PAGE_TYPE_UNKNOWN ||
page_type == FIL_PAGE_ENCRYPTED ||
page_type == FIL_PAGE_COMPRESSED_AND_ENCRYPTED ||
page_type == FIL_PAGE_ENCRYPTED_RTREE))) {
uint key_version = mach_read_from_4(page + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION); uint key_version = mach_read_from_4(page + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION);
bool page_compressed = (page_type == FIL_PAGE_PAGE_COMPRESSED); bool page_compressed = (page_type == FIL_PAGE_PAGE_COMPRESSED);
...@@ -167,7 +180,13 @@ fil_page_type_validate( ...@@ -167,7 +180,13 @@ fil_page_type_validate(
page_type == FIL_PAGE_TYPE_XDES || page_type == FIL_PAGE_TYPE_XDES ||
page_type == FIL_PAGE_TYPE_BLOB || page_type == FIL_PAGE_TYPE_BLOB ||
page_type == FIL_PAGE_TYPE_ZBLOB || page_type == FIL_PAGE_TYPE_ZBLOB ||
page_type == FIL_PAGE_COMPRESSED); page_type == FIL_PAGE_TYPE_ZBLOB2 ||
page_type == FIL_PAGE_COMPRESSED ||
page_type == FIL_PAGE_TYPE_UNKNOWN ||
page_type == FIL_PAGE_ENCRYPTED ||
page_type == FIL_PAGE_COMPRESSED_AND_ENCRYPTED ||
page_type == FIL_PAGE_ENCRYPTED_RTREE);
return false; return false;
} }
......
...@@ -5041,6 +5041,19 @@ page_zip_verify_checksum( ...@@ -5041,6 +5041,19 @@ page_zip_verify_checksum(
const uint32_t stored = static_cast<uint32_t>( const uint32_t stored = static_cast<uint32_t>(
mach_read_from_4(p)); mach_read_from_4(p));
#ifdef UNIV_INNOCHECKSUM
p = static_cast<const unsigned char*>(data) + FIL_PAGE_TYPE;
bool no_checksum = (mach_read_from_2(p) == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED);
p = static_cast<const unsigned char*>(data) + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION;
bool encrypted = (mach_read_from_4(p) != 0);
p = static_cast<const unsigned char*>(data) + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION + 4;
const uint32_t checksum = static_cast<uint32_t>(mach_read_from_4(p));
if (no_checksum) {
return (TRUE);
}
#endif
#if FIL_PAGE_LSN % 8 #if FIL_PAGE_LSN % 8
#error "FIL_PAGE_LSN must be 64 bit aligned" #error "FIL_PAGE_LSN must be 64 bit aligned"
#endif #endif
...@@ -5121,7 +5134,12 @@ page_zip_verify_checksum( ...@@ -5121,7 +5134,12 @@ page_zip_verify_checksum(
} }
} }
#endif /* UNIV_INNOCHECKSUM */ #endif /* UNIV_INNOCHECKSUM */
if (stored == calc) {
if (stored == calc
#ifdef UNIV_INNOCHECKSUM
|| ( encrypted == true && stored == checksum)
#endif
) {
return(TRUE); return(TRUE);
} }
...@@ -5129,7 +5147,7 @@ page_zip_verify_checksum( ...@@ -5129,7 +5147,7 @@ page_zip_verify_checksum(
switch (curr_algo) { switch (curr_algo) {
case SRV_CHECKSUM_ALGORITHM_STRICT_CRC32: case SRV_CHECKSUM_ALGORITHM_STRICT_CRC32:
case SRV_CHECKSUM_ALGORITHM_CRC32: case SRV_CHECKSUM_ALGORITHM_CRC32: {
if (stored == BUF_NO_CHECKSUM_MAGIC) { if (stored == BUF_NO_CHECKSUM_MAGIC) {
#ifndef UNIV_INNOCHECKSUM #ifndef UNIV_INNOCHECKSUM
...@@ -5151,16 +5169,27 @@ page_zip_verify_checksum( ...@@ -5151,16 +5169,27 @@ page_zip_verify_checksum(
matching legacy big endian checksum, we try to match it first. matching legacy big endian checksum, we try to match it first.
Otherwise we check innodb checksum first. */ Otherwise we check innodb checksum first. */
if (legacy_big_endian_checksum) { if (legacy_big_endian_checksum) {
if (stored == page_zip_calc_checksum( const uint32_t calculated =
data, size, curr_algo, true)) { page_zip_calc_checksum(data, size, curr_algo, true);
if (stored == calculated
#ifdef UNIV_INNOCHECKSUM
|| ( encrypted == true && calculated == checksum)
#endif
) {
return(TRUE); return(TRUE);
} }
legacy_checksum_checked = true; legacy_checksum_checked = true;
} }
if (stored == page_zip_calc_checksum( uint32_t calculated =
data, size, SRV_CHECKSUM_ALGORITHM_INNODB)) { page_zip_calc_checksum(data, size, SRV_CHECKSUM_ALGORITHM_INNODB);
if (stored == calculated
#ifdef UNIV_INNOCHECKSUM
|| ( encrypted == true && stored == checksum)
#endif
) {
#ifndef UNIV_INNOCHECKSUM #ifndef UNIV_INNOCHECKSUM
if (curr_algo if (curr_algo
...@@ -5175,20 +5204,30 @@ page_zip_verify_checksum( ...@@ -5175,20 +5204,30 @@ page_zip_verify_checksum(
return(TRUE); return(TRUE);
} }
/* If legacy checksum is not checked, do it now. */ calculated = page_zip_calc_checksum(
if (!legacy_checksum_checked data, size, curr_algo, true);
&& stored == page_zip_calc_checksum(
data, size, curr_algo, true)) {
/* If legacy checksum is not checked, do it now. */
if ((legacy_checksum_checked
&& stored == calculated)
#ifdef UNIV_INNOCHECKSUM
|| ( encrypted == true && calculated == checksum)
#endif
) {
legacy_big_endian_checksum = true; legacy_big_endian_checksum = true;
return(TRUE); return(TRUE);
} }
break; break;
}
case SRV_CHECKSUM_ALGORITHM_STRICT_INNODB: case SRV_CHECKSUM_ALGORITHM_STRICT_INNODB:
case SRV_CHECKSUM_ALGORITHM_INNODB: case SRV_CHECKSUM_ALGORITHM_INNODB: {
if (stored == BUF_NO_CHECKSUM_MAGIC) { if (stored == BUF_NO_CHECKSUM_MAGIC
#ifdef UNIV_INNOCHECKSUM
|| ( encrypted == true && checksum == BUF_NO_CHECKSUM_MAGIC)
#endif
) {
#ifndef UNIV_INNOCHECKSUM #ifndef UNIV_INNOCHECKSUM
if (curr_algo if (curr_algo
== SRV_CHECKSUM_ALGORITHM_STRICT_INNODB) { == SRV_CHECKSUM_ALGORITHM_STRICT_INNODB) {
...@@ -5202,10 +5241,18 @@ page_zip_verify_checksum( ...@@ -5202,10 +5241,18 @@ page_zip_verify_checksum(
return(TRUE); return(TRUE);
} }
if (stored == page_zip_calc_checksum( const uint32_t calculated = page_zip_calc_checksum(
data, size, SRV_CHECKSUM_ALGORITHM_CRC32) data, size, SRV_CHECKSUM_ALGORITHM_CRC32);
|| stored == page_zip_calc_checksum( const uint32_t calculated1 = page_zip_calc_checksum(
data, size, SRV_CHECKSUM_ALGORITHM_CRC32, true)) { data, size, SRV_CHECKSUM_ALGORITHM_CRC32, true);
if (stored == calculated
|| stored == calculated1
#ifdef UNIV_INNOCHECKSUM
|| ( encrypted == true && checksum == calculated)
|| ( encrypted == true && checksum == calculated1)
#endif
) {
#ifndef UNIV_INNOCHECKSUM #ifndef UNIV_INNOCHECKSUM
if (curr_algo if (curr_algo
== SRV_CHECKSUM_ALGORITHM_STRICT_INNODB) { == SRV_CHECKSUM_ALGORITHM_STRICT_INNODB) {
...@@ -5219,12 +5266,21 @@ page_zip_verify_checksum( ...@@ -5219,12 +5266,21 @@ page_zip_verify_checksum(
} }
break; break;
case SRV_CHECKSUM_ALGORITHM_STRICT_NONE: }
case SRV_CHECKSUM_ALGORITHM_STRICT_NONE: {
uint32_t calculated = page_zip_calc_checksum(
data, size, SRV_CHECKSUM_ALGORITHM_CRC32);
const uint32_t calculated1 = page_zip_calc_checksum(
data, size, SRV_CHECKSUM_ALGORITHM_CRC32, true);
if (stored == page_zip_calc_checksum( if (stored == calculated
data, size, SRV_CHECKSUM_ALGORITHM_CRC32) || stored == calculated1
|| stored == page_zip_calc_checksum( #ifdef UNIV_INNOCHECKSUM
data, size, SRV_CHECKSUM_ALGORITHM_CRC32, true)) { || ( encrypted == true && checksum == calculated)
|| ( encrypted == true && checksum == calculated1)
#endif
) {
#ifndef UNIV_INNOCHECKSUM #ifndef UNIV_INNOCHECKSUM
page_warn_strict_checksum( page_warn_strict_checksum(
curr_algo, curr_algo,
...@@ -5234,8 +5290,14 @@ page_zip_verify_checksum( ...@@ -5234,8 +5290,14 @@ page_zip_verify_checksum(
return(TRUE); return(TRUE);
} }
if (stored == page_zip_calc_checksum( calculated = page_zip_calc_checksum(
data, size, SRV_CHECKSUM_ALGORITHM_INNODB)) { data, size, SRV_CHECKSUM_ALGORITHM_INNODB);
if (stored == calculated
#ifdef UNIV_INNOCHECKSUM
|| ( encrypted == true && checksum == calculated)
#endif
) {
#ifndef UNIV_INNOCHECKSUM #ifndef UNIV_INNOCHECKSUM
page_warn_strict_checksum( page_warn_strict_checksum(
...@@ -5247,6 +5309,7 @@ page_zip_verify_checksum( ...@@ -5247,6 +5309,7 @@ page_zip_verify_checksum(
} }
break; break;
}
case SRV_CHECKSUM_ALGORITHM_NONE: case SRV_CHECKSUM_ALGORITHM_NONE:
ut_error; ut_error;
/* no default so the compiler will emit a warning if new enum /* no default so the compiler will emit a warning if new enum
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment