Commit 6b698715 authored by Jan Lindström's avatar Jan Lindström

MDEV-12114: install_db shows corruption for rest encryption and...

MDEV-12114: install_db shows corruption for rest encryption and innodb_checksum_algorithm=strict_none

Problem was that checksum check resulted false positives that page is
both not encrypted and encryted when checksum_algorithm was
strict_none.

Encrypton checksum will use only crc32 regardless of setting.

buf_zip_decompress: If compression fails report a error message
containing the space name if available (not available during import).
And note if space could be encrypted.

buf_page_get_gen: Do not assert if decompression fails,
instead unfix the page and return NULL to upper layer.

fil_crypt_calculate_checksum: Use only crc32 method.

fil_space_verify_crypt_checksum: Here we need to check
crc32, innodb and none method for old datafiles.

fil_space_release_for_io: Allow null space.

encryption.innodb-compressed-blob is now run with crc32 and none
combinations.

Note that with none and strict_none method there is not really
a way to detect page corruptions and page corruptions after
decrypting the page with incorrect key.

New test innodb-checksum-algorithm to test different checksum
algorithms with encrypted, row compressed and page compressed
tables.
parent 1af8bf39
SET GLOBAL innodb_file_format = `Barracuda`;
SET GLOBAL innodb_file_per_table = ON;
call mtr.add_suppression("InnoDB: innodb_checksum_algorithm is set to \"strict_crc32\" but the page \\[page id: space=[0-9]+, page number=[0-9]+\\] contains a valid checksum \"innodb\". Accepting the page as valid. Change innodb_checksum_algorithm to \"crc32\" to silently accept such pages or rewrite all pages so that they contain \"crc32\" checksum.");
call mtr.add_suppression("InnoDB: innodb_checksum_algorithm is set to \"strict_none\" but the page \\[page id: space=[0-9]+, page number=[0-9]+\\] contains a valid checksum \"innodb\". Accepting the page as valid. Change innodb_checksum_algorithm to \"none\" to silently accept such pages or rewrite all pages so that they contain \"none\" checksum.");
call mtr.add_suppression("InnoDB: innodb_checksum_algorithm is set to \"strict_crc32\" but the page \\[page id: space=[0-9]+, page number=[0-9]+\\] contains a valid checksum \"none\". Accepting the page as valid. Change innodb_checksum_algorithm to \"crc32\" to silently accept such pages or rewrite all pages so that they contain \"crc32\" checksum.");
call mtr.add_suppression("InnoDB: innodb_checksum_algorithm is set to \"strict_innodb\" but the page \\[page id: space=[0-9]+, page number=[0-9]+\\] contains a valid checksum \"none\". Accepting the page as valid. Change innodb_checksum_algorithm to \"innodb\" to silently accept such pages or rewrite all pages so that they contain \"innodb\" checksum.");
call mtr.add_suppression("InnoDB: innodb_checksum_algorithm is set to \"strict_innodb\" but the page \\[page id: space=[0-9]+, page number=[0-9]+\\] contains a valid checksum \"crc32\". Accepting the page as valid. Change innodb_checksum_algorithm to \"innodb\" to silently accept such pages or rewrite all pages so that they contain \"innodb\" checksum.");
call mtr.add_suppression("InnoDB: innodb_checksum_algorithm is set to \"strict_none\" but the page \\[page id: space=[0-9]+, page number=[0-9]+\\] contains a valid checksum \"crc32\". Accepting the page as valid. Change innodb_checksum_algorithm to \"none\" to silently accept such pages or rewrite all pages so that they contain \"none\" checksum.");
set GLOBAL innodb_default_encryption_key_id=4;
create table t1(a int not null auto_increment primary key, b blob, index(b(10))) engine=innodb row_format=compressed encrypted=yes;
create table t2(a int not null auto_increment primary key, b blob, index(b(10))) engine=innodb encrypted=yes;
create table t3(a int not null auto_increment primary key, b blob, index(b(10))) engine=innodb row_format=compressed encrypted=no;
create table t4(a int not null auto_increment primary key, b blob, index(b(10))) engine=innodb encrypted=no;
create table t5(a int not null auto_increment primary key, b blob, index(b(10))) engine=innodb encrypted=yes page_compressed=yes;
begin;
insert into t1(b) values (repeat('secret',20));
insert into t1(b) select b from t1;
insert into t1(b) select b from t1;
insert into t1(b) select b from t1;
insert into t1(b) select b from t1;
insert into t1(b) select b from t1;
insert into t2(b) select b from t1;
insert into t3(b) select b from t1;
insert into t4(b) select b from t1;
insert into t5(b) select b from t1;
commit;
# 1 Restart mysqld --innodb-checksum-algorithm=crc32
select count(*) from t1;
count(*)
32
select count(*) from t2;
count(*)
32
select count(*) from t3;
count(*)
32
select count(*) from t4;
count(*)
32
select count(*) from t5;
count(*)
32
insert into t1(b) select b from t1;
insert into t2(b) select b from t1;
insert into t3(b) select b from t1;
insert into t4(b) select b from t1;
insert into t5(b) select b from t1;
# 2 Restart mysqld --innodb-checksum-algorithm=innodb
select count(*) from t1;
count(*)
64
select count(*) from t2;
count(*)
96
select count(*) from t3;
count(*)
96
select count(*) from t4;
count(*)
96
select count(*) from t5;
count(*)
96
insert into t1(b) select b from t1 limit 100;
insert into t2(b) select b from t1 limit 100;
insert into t3(b) select b from t1 limit 100;
insert into t4(b) select b from t1 limit 100;
insert into t5(b) select b from t1 limit 100;
# 3 Restart mysqld --innodb-checksum-algorithm=none
select count(*) from t1;
count(*)
128
select count(*) from t2;
count(*)
196
select count(*) from t3;
count(*)
196
select count(*) from t4;
count(*)
196
select count(*) from t5;
count(*)
196
insert into t1(b) select b from t1 limit 100;
insert into t2(b) select b from t1 limit 100;
insert into t3(b) select b from t1 limit 100;
insert into t4(b) select b from t1 limit 100;
insert into t5(b) select b from t1 limit 100;
# 4 Restart mysqld --innodb-checksum-algorithm=innodb
select count(*) from t1;
count(*)
228
select count(*) from t2;
count(*)
296
select count(*) from t3;
count(*)
296
select count(*) from t4;
count(*)
296
select count(*) from t5;
count(*)
296
insert into t1(b) select b from t1 limit 100;
insert into t2(b) select b from t1 limit 100;
insert into t3(b) select b from t1 limit 100;
insert into t4(b) select b from t1 limit 100;
insert into t5(b) select b from t1 limit 100;
# 5 Restart mysqld --innodb-checksum-algorithm=strict_innodb
select count(*) from t1;
count(*)
328
select count(*) from t2;
count(*)
396
select count(*) from t3;
count(*)
396
select count(*) from t4;
count(*)
396
select count(*) from t5;
count(*)
396
insert into t1(b) select b from t1 limit 100;
insert into t2(b) select b from t1 limit 100;
insert into t3(b) select b from t1 limit 100;
insert into t4(b) select b from t1 limit 100;
insert into t5(b) select b from t1 limit 100;
# 6 Restart mysqld --innodb-checksum-algorithm=innodb
select count(*) from t1;
count(*)
428
select count(*) from t2;
count(*)
496
select count(*) from t3;
count(*)
496
select count(*) from t4;
count(*)
496
select count(*) from t5;
count(*)
496
insert into t1(b) select b from t1 limit 100;
insert into t2(b) select b from t1 limit 100;
insert into t3(b) select b from t1 limit 100;
insert into t4(b) select b from t1 limit 100;
insert into t5(b) select b from t1 limit 100;
# 7 Restart mysqld --innodb-checksum-algorithm=strict_none
select count(*) from t1;
count(*)
528
select count(*) from t2;
count(*)
596
select count(*) from t3;
count(*)
596
select count(*) from t4;
count(*)
596
select count(*) from t5;
count(*)
596
insert into t1(b) select b from t1 limit 100;
insert into t2(b) select b from t1 limit 100;
insert into t3(b) select b from t1 limit 100;
insert into t4(b) select b from t1 limit 100;
insert into t5(b) select b from t1 limit 100;
# 8 Restart mysqld --innodb-checksum-algorithm=innodb
select count(*) from t1;
count(*)
628
select count(*) from t2;
count(*)
696
select count(*) from t3;
count(*)
696
select count(*) from t4;
count(*)
696
select count(*) from t5;
count(*)
696
insert into t1(b) select b from t1 limit 100;
insert into t2(b) select b from t1 limit 100;
insert into t3(b) select b from t1 limit 100;
insert into t4(b) select b from t1 limit 100;
insert into t5(b) select b from t1 limit 100;
# 9 Restart mysqld --innodb-checksum-algorithm=strict_crc32
select count(*) from t1;
count(*)
728
select count(*) from t2;
count(*)
796
select count(*) from t3;
count(*)
796
select count(*) from t4;
count(*)
796
select count(*) from t5;
count(*)
796
insert into t1(b) select b from t1 limit 100;
insert into t2(b) select b from t1 limit 100;
insert into t3(b) select b from t1 limit 100;
insert into t4(b) select b from t1 limit 100;
insert into t5(b) select b from t1 limit 100;
# 10 Restart mysqld --innodb-checksum-algorithm=innodb
select count(*) from t1;
count(*)
828
select count(*) from t2;
count(*)
896
select count(*) from t3;
count(*)
896
select count(*) from t4;
count(*)
896
select count(*) from t5;
count(*)
896
insert into t1(b) select b from t1 limit 100;
insert into t2(b) select b from t1 limit 100;
insert into t3(b) select b from t1 limit 100;
insert into t4(b) select b from t1 limit 100;
insert into t5(b) select b from t1 limit 100;
# Restart mysqld --innodb-checksum-algorithm=crc32
select count(*) from t1;
count(*)
928
select count(*) from t2;
count(*)
996
select count(*) from t3;
count(*)
996
select count(*) from t4;
count(*)
996
select count(*) from t5;
count(*)
996
insert into t1(b) select b from t1 limit 100;
insert into t2(b) select b from t1 limit 100;
insert into t3(b) select b from t1 limit 100;
insert into t4(b) select b from t1 limit 100;
insert into t5(b) select b from t1 limit 100;
# 11 Restart mysqld --innodb-checksum-algorithm=strict_crc32
select count(*) from t1;
count(*)
1028
select count(*) from t2;
count(*)
1096
select count(*) from t3;
count(*)
1096
select count(*) from t4;
count(*)
1096
select count(*) from t5;
count(*)
1096
insert into t1(b) select b from t1 limit 100;
insert into t2(b) select b from t1 limit 100;
insert into t3(b) select b from t1 limit 100;
insert into t4(b) select b from t1 limit 100;
insert into t5(b) select b from t1 limit 100;
# 12 Restart mysqld --innodb-checksum-algorithm=crc32
select count(*) from t1;
count(*)
1128
select count(*) from t2;
count(*)
1196
select count(*) from t3;
count(*)
1196
select count(*) from t4;
count(*)
1196
select count(*) from t5;
count(*)
1196
insert into t1(b) select b from t1 limit 100;
insert into t2(b) select b from t1 limit 100;
insert into t3(b) select b from t1 limit 100;
insert into t4(b) select b from t1 limit 100;
insert into t5(b) select b from t1 limit 100;
# 13 Restart mysqld --innodb-checksum-algorithm=strict_none
select count(*) from t1;
count(*)
1228
select count(*) from t2;
count(*)
1296
select count(*) from t3;
count(*)
1296
select count(*) from t4;
count(*)
1296
select count(*) from t5;
count(*)
1296
insert into t1(b) select b from t1 limit 100;
insert into t2(b) select b from t1 limit 100;
insert into t3(b) select b from t1 limit 100;
insert into t4(b) select b from t1 limit 100;
insert into t5(b) select b from t1 limit 100;
# 14 Restart mysqld --innodb-checksum-algorithm=crc32
select count(*) from t1;
count(*)
1328
select count(*) from t2;
count(*)
1396
select count(*) from t3;
count(*)
1396
select count(*) from t4;
count(*)
1396
select count(*) from t5;
count(*)
1396
insert into t1(b) select b from t1 limit 100;
insert into t2(b) select b from t1 limit 100;
insert into t3(b) select b from t1 limit 100;
insert into t4(b) select b from t1 limit 100;
insert into t5(b) select b from t1 limit 100;
# 15 Restart mysqld --innodb-checksum-algorithm=strict_innodb
select count(*) from t1;
count(*)
1428
select count(*) from t2;
count(*)
1496
select count(*) from t3;
count(*)
1496
select count(*) from t4;
count(*)
1496
select count(*) from t5;
count(*)
1496
insert into t1(b) select b from t1 limit 100;
insert into t2(b) select b from t1 limit 100;
insert into t3(b) select b from t1 limit 100;
insert into t4(b) select b from t1 limit 100;
insert into t5(b) select b from t1 limit 100;
# 16 Restart mysqld --innodb-checksum-algorithm=crc32
select count(*) from t1;
count(*)
1528
select count(*) from t2;
count(*)
1596
select count(*) from t3;
count(*)
1596
select count(*) from t4;
count(*)
1596
select count(*) from t5;
count(*)
1596
insert into t1(b) select b from t1 limit 100;
insert into t2(b) select b from t1 limit 100;
insert into t3(b) select b from t1 limit 100;
insert into t4(b) select b from t1 limit 100;
insert into t5(b) select b from t1 limit 100;
# 17 Restart mysqld --innodb-checksum-algorithm=none
select count(*) from t1;
count(*)
1628
select count(*) from t2;
count(*)
1696
select count(*) from t3;
count(*)
1696
select count(*) from t4;
count(*)
1696
select count(*) from t5;
count(*)
1696
insert into t1(b) select b from t1 limit 100;
insert into t2(b) select b from t1 limit 100;
insert into t3(b) select b from t1 limit 100;
insert into t4(b) select b from t1 limit 100;
insert into t5(b) select b from t1 limit 100;
# 18 Restart mysqld --innodb-checksum-algorithm=crc32
select count(*) from t1;
count(*)
1728
select count(*) from t2;
count(*)
1796
select count(*) from t3;
count(*)
1796
select count(*) from t4;
count(*)
1796
select count(*) from t5;
count(*)
1796
insert into t1(b) select b from t1 limit 100;
insert into t2(b) select b from t1 limit 100;
insert into t3(b) select b from t1 limit 100;
insert into t4(b) select b from t1 limit 100;
insert into t5(b) select b from t1 limit 100;
# Restart mysqld --innodb-checksum-algorithm=strict_crc32
select count(*) from t1;
count(*)
1828
select count(*) from t2;
count(*)
1896
select count(*) from t3;
count(*)
1896
select count(*) from t4;
count(*)
1896
select count(*) from t5;
count(*)
1896
insert into t1(b) select b from t1 limit 100;
insert into t2(b) select b from t1 limit 100;
insert into t3(b) select b from t1 limit 100;
insert into t4(b) select b from t1 limit 100;
insert into t5(b) select b from t1 limit 100;
# 19 Restart mysqld --innodb-checksum-algorithm=strict_none
select count(*) from t1;
count(*)
1928
select count(*) from t2;
count(*)
1996
select count(*) from t3;
count(*)
1996
select count(*) from t4;
count(*)
1996
select count(*) from t5;
count(*)
1996
insert into t1(b) select b from t1 limit 100;
insert into t2(b) select b from t1 limit 100;
insert into t3(b) select b from t1 limit 100;
insert into t4(b) select b from t1 limit 100;
insert into t5(b) select b from t1 limit 100;
# 20 Restart mysqld --innodb-checksum-algorithm=strict_crc32
select count(*) from t1;
count(*)
2028
select count(*) from t2;
count(*)
2096
select count(*) from t3;
count(*)
2096
select count(*) from t4;
count(*)
2096
select count(*) from t5;
count(*)
2096
insert into t1(b) select b from t1 limit 100;
insert into t2(b) select b from t1 limit 100;
insert into t3(b) select b from t1 limit 100;
insert into t4(b) select b from t1 limit 100;
insert into t5(b) select b from t1 limit 100;
# 21 Restart mysqld --innodb-checksum-algorithm=strict_innodb
select count(*) from t1;
count(*)
2128
select count(*) from t2;
count(*)
2196
select count(*) from t3;
count(*)
2196
select count(*) from t4;
count(*)
2196
select count(*) from t5;
count(*)
2196
insert into t1(b) select b from t1 limit 100;
insert into t2(b) select b from t1 limit 100;
insert into t3(b) select b from t1 limit 100;
insert into t4(b) select b from t1 limit 100;
insert into t5(b) select b from t1 limit 100;
# 22 Restart mysqld --innodb-checksum-algorithm=strict_crc32
select count(*) from t1;
count(*)
2228
select count(*) from t2;
count(*)
2296
select count(*) from t3;
count(*)
2296
select count(*) from t4;
count(*)
2296
select count(*) from t5;
count(*)
2296
insert into t1(b) select b from t1 limit 100;
insert into t2(b) select b from t1 limit 100;
insert into t3(b) select b from t1 limit 100;
insert into t4(b) select b from t1 limit 100;
insert into t5(b) select b from t1 limit 100;
# 23 Restart mysqld --innodb-checksum-algorithm=none
select count(*) from t1;
count(*)
2328
select count(*) from t2;
count(*)
2396
select count(*) from t3;
count(*)
2396
select count(*) from t4;
count(*)
2396
select count(*) from t5;
count(*)
2396
insert into t1(b) select b from t1 limit 100;
insert into t2(b) select b from t1 limit 100;
insert into t3(b) select b from t1 limit 100;
insert into t4(b) select b from t1 limit 100;
insert into t5(b) select b from t1 limit 100;
# 24 Restart mysqld --innodb-checksum-algorithm=strict_crc32
select count(*) from t1;
count(*)
2428
select count(*) from t2;
count(*)
2496
select count(*) from t3;
count(*)
2496
select count(*) from t4;
count(*)
2496
select count(*) from t5;
count(*)
2496
insert into t1(b) select b from t1 limit 100;
insert into t2(b) select b from t1 limit 100;
insert into t3(b) select b from t1 limit 100;
insert into t4(b) select b from t1 limit 100;
insert into t5(b) select b from t1 limit 100;
# Restart mysqld --innodb-checksum-algorithm=strict_none
select count(*) from t1;
count(*)
2528
select count(*) from t2;
count(*)
2596
select count(*) from t3;
count(*)
2596
select count(*) from t4;
count(*)
2596
select count(*) from t5;
count(*)
2596
insert into t1(b) select b from t1 limit 100;
insert into t2(b) select b from t1 limit 100;
insert into t3(b) select b from t1 limit 100;
insert into t4(b) select b from t1 limit 100;
insert into t5(b) select b from t1 limit 100;
# 25 Restart mysqld --innodb-checksum-algorithm=none
select count(*) from t1;
count(*)
2628
select count(*) from t2;
count(*)
2696
select count(*) from t3;
count(*)
2696
select count(*) from t4;
count(*)
2696
select count(*) from t5;
count(*)
2696
insert into t1(b) select b from t1 limit 100;
insert into t2(b) select b from t1 limit 100;
insert into t3(b) select b from t1 limit 100;
insert into t4(b) select b from t1 limit 100;
insert into t5(b) select b from t1 limit 100;
# 26 Restart mysqld --innodb-checksum-algorithm=strict_none
select count(*) from t1;
count(*)
2728
select count(*) from t2;
count(*)
2796
select count(*) from t3;
count(*)
2796
select count(*) from t4;
count(*)
2796
select count(*) from t5;
count(*)
2796
insert into t1(b) select b from t1 limit 100;
insert into t2(b) select b from t1 limit 100;
insert into t3(b) select b from t1 limit 100;
insert into t4(b) select b from t1 limit 100;
insert into t5(b) select b from t1 limit 100;
# 27 Restart mysqld --innodb-checksum-algorithm=strict_innodb
select count(*) from t1;
count(*)
2828
select count(*) from t2;
count(*)
2896
select count(*) from t3;
count(*)
2896
select count(*) from t4;
count(*)
2896
select count(*) from t5;
count(*)
2896
insert into t1(b) select b from t1 limit 100;
insert into t2(b) select b from t1 limit 100;
insert into t3(b) select b from t1 limit 100;
insert into t4(b) select b from t1 limit 100;
insert into t5(b) select b from t1 limit 100;
# 28 Restart mysqld --innodb-checksum-algorithm=strict_none
select count(*) from t1;
count(*)
2928
select count(*) from t2;
count(*)
2996
select count(*) from t3;
count(*)
2996
select count(*) from t4;
count(*)
2996
select count(*) from t5;
count(*)
2996
insert into t1(b) select b from t1 limit 100;
insert into t2(b) select b from t1 limit 100;
insert into t3(b) select b from t1 limit 100;
insert into t4(b) select b from t1 limit 100;
insert into t5(b) select b from t1 limit 100;
# Restart mysqld --innodb-checksum-algorithm=none
select count(*) from t1;
count(*)
3028
select count(*) from t2;
count(*)
3096
select count(*) from t3;
count(*)
3096
select count(*) from t4;
count(*)
3096
select count(*) from t5;
count(*)
3096
insert into t1(b) select b from t1 limit 100;
insert into t2(b) select b from t1 limit 100;
insert into t3(b) select b from t1 limit 100;
insert into t4(b) select b from t1 limit 100;
insert into t5(b) select b from t1 limit 100;
# 29 Restart mysqld --innodb-checksum-algorithm=strict_innodb
select count(*) from t1;
count(*)
3128
select count(*) from t2;
count(*)
3196
select count(*) from t3;
count(*)
3196
select count(*) from t4;
count(*)
3196
select count(*) from t5;
count(*)
3196
insert into t1(b) select b from t1 limit 100;
insert into t2(b) select b from t1 limit 100;
insert into t3(b) select b from t1 limit 100;
insert into t4(b) select b from t1 limit 100;
insert into t5(b) select b from t1 limit 100;
# 30 Restart mysqld --innodb-checksum-algorithm=none
select count(*) from t1;
count(*)
3228
select count(*) from t2;
count(*)
3296
select count(*) from t3;
count(*)
3296
select count(*) from t4;
count(*)
3296
select count(*) from t5;
count(*)
3296
insert into t1(b) select b from t1 limit 100;
insert into t2(b) select b from t1 limit 100;
insert into t3(b) select b from t1 limit 100;
insert into t4(b) select b from t1 limit 100;
insert into t5(b) select b from t1 limit 100;
drop table t1,t2,t3,t4,t5;
call mtr.add_suppression("InnoDB: However key management plugin or used key_version .*"); call mtr.add_suppression("InnoDB: However key management plugin or used key_version .*");
call mtr.add_suppression("InnoDB: The page \[page id: space=[0-9]+, page number=[0-9]+\] in file test/t1 cannot be decrypted."); call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[0-9]+\\] in file test/t[1-3] cannot be decrypted.");
call mtr.add_suppression("InnoDB: The page \[page id: space=[0-9]+, page number=[0-9]+\] in file test/t2 cannot be decrypted."); call mtr.add_suppression("Unable to decompress space ..test.t[1-3].ibd \\[[1-9][0-9]*:[0-9]+\\]");
call mtr.add_suppression("InnoDB: The page \[page id: space=[0-9]+, page number=[0-9]+\] in file test/t3 cannot be decrypted.");
# Restart mysqld --file-key-management-filename=keys2.txt # Restart mysqld --file-key-management-filename=keys2.txt
SET GLOBAL innodb_file_format = `Barracuda`; SET GLOBAL innodb_file_format = `Barracuda`;
SET GLOBAL innodb_file_per_table = ON; SET GLOBAL innodb_file_per_table = ON;
......
--innodb_checksum_algorithm=innodb
--innodb-tablespaces-encryption --innodb-tablespaces-encryption
--innodb-encrypt-tables=on --innodb-encrypt-tables=on
--innodb-encryption-threads=2 --innodb-encryption-threads=4
--max_allowed_packet=64K
-- source include/have_innodb.inc
-- source include/have_file_key_management_plugin.inc
# embedded does not support restart
-- source include/not_embedded.inc
#
# Tests:
#
# innodb
# 1) innodb => crc32
# 2) crc32 => innodb
# 3) innodb => none
# 4) none => innodb
# 5) innodb => strict_innodb
# 6) strict_innodb => innodb
# 7) innodb => strict_none
# 8) strict_none => innodb
# 9) innodb => strict_crc32
# 10) strict_crc32 => innodb
#
# crc32
# 11) crc32 => strict_crc32
# 12) strict_crc32 => crc32
# 13) crc32 => strict_none
# 14) strict_none => crc32
# 15) crc32 => strict_innodb
# 16) strict_innodb => crc32
# 17) crc32 => none
# 18) none => crc32
# (note that innodb is handled on 1 and 2)
#
# strict_crc32
# 19) strict_crc32 => strict_none
# 20) strict_none => strict_crc32
# 21) strict_crc32 => strict_innodb
# 22) strict_innodb => strict_crc32
# 23) strict_crc32 => none
# 24) none => strict_crc32
# (note that innodb is handled on 9 and 10)
# (note that crc32 is handled on 11 and 12)
#
# strict_none
# 25) strict_none => none
# 26) none => strict_none
# 27) strict_none = strict_innodb
# 28) strict_innodb => strict_none
# (note that innodb is handled on 7 and 8)
# (note that crc32 is handled on 13 and 14)
# (note that strict_crc32 is handled 19 and 20)
#
# none
# 29) none => strict_innodb
# 30) strict_innodb => none
# (note that innodb is handled on 3 and 4)
# (note that crc32 is handled on 17 and 18)
# (note that strict_crc32 is handled on 23 and 24)
# (note that strict_none is handled on 25 and 26)
#
# strict_innodb
# (note that innodb is handled on 5 and 6)
# (note that crc32 is handled on 15 and 16)
# (note that strict_crc32 is handled on 21 and 22)
# (note that strict_none is handled on 27 and 28)
# (note that none is handled on 29 and 30)
#
--disable_warnings
SET GLOBAL innodb_file_format = `Barracuda`;
SET GLOBAL innodb_file_per_table = ON;
call mtr.add_suppression("InnoDB: innodb_checksum_algorithm is set to \"strict_crc32\" but the page \\[page id: space=[0-9]+, page number=[0-9]+\\] contains a valid checksum \"innodb\". Accepting the page as valid. Change innodb_checksum_algorithm to \"crc32\" to silently accept such pages or rewrite all pages so that they contain \"crc32\" checksum.");
call mtr.add_suppression("InnoDB: innodb_checksum_algorithm is set to \"strict_none\" but the page \\[page id: space=[0-9]+, page number=[0-9]+\\] contains a valid checksum \"innodb\". Accepting the page as valid. Change innodb_checksum_algorithm to \"none\" to silently accept such pages or rewrite all pages so that they contain \"none\" checksum.");
call mtr.add_suppression("InnoDB: innodb_checksum_algorithm is set to \"strict_crc32\" but the page \\[page id: space=[0-9]+, page number=[0-9]+\\] contains a valid checksum \"none\". Accepting the page as valid. Change innodb_checksum_algorithm to \"crc32\" to silently accept such pages or rewrite all pages so that they contain \"crc32\" checksum.");
call mtr.add_suppression("InnoDB: innodb_checksum_algorithm is set to \"strict_innodb\" but the page \\[page id: space=[0-9]+, page number=[0-9]+\\] contains a valid checksum \"none\". Accepting the page as valid. Change innodb_checksum_algorithm to \"innodb\" to silently accept such pages or rewrite all pages so that they contain \"innodb\" checksum.");
call mtr.add_suppression("InnoDB: innodb_checksum_algorithm is set to \"strict_innodb\" but the page \\[page id: space=[0-9]+, page number=[0-9]+\\] contains a valid checksum \"crc32\". Accepting the page as valid. Change innodb_checksum_algorithm to \"innodb\" to silently accept such pages or rewrite all pages so that they contain \"innodb\" checksum.");
call mtr.add_suppression("InnoDB: innodb_checksum_algorithm is set to \"strict_none\" but the page \\[page id: space=[0-9]+, page number=[0-9]+\\] contains a valid checksum \"crc32\". Accepting the page as valid. Change innodb_checksum_algorithm to \"none\" to silently accept such pages or rewrite all pages so that they contain \"none\" checksum.");
--enable_warnings
set GLOBAL innodb_default_encryption_key_id=4;
create table t1(a int not null auto_increment primary key, b blob, index(b(10))) engine=innodb row_format=compressed encrypted=yes;
create table t2(a int not null auto_increment primary key, b blob, index(b(10))) engine=innodb encrypted=yes;
create table t3(a int not null auto_increment primary key, b blob, index(b(10))) engine=innodb row_format=compressed encrypted=no;
create table t4(a int not null auto_increment primary key, b blob, index(b(10))) engine=innodb encrypted=no;
create table t5(a int not null auto_increment primary key, b blob, index(b(10))) engine=innodb encrypted=yes page_compressed=yes;
begin;
insert into t1(b) values (repeat('secret',20));
insert into t1(b) select b from t1;
insert into t1(b) select b from t1;
insert into t1(b) select b from t1;
insert into t1(b) select b from t1;
insert into t1(b) select b from t1;
insert into t2(b) select b from t1;
insert into t3(b) select b from t1;
insert into t4(b) select b from t1;
insert into t5(b) select b from t1;
commit;
--echo # 1 Restart mysqld --innodb-checksum-algorithm=crc32
-- let $restart_parameters=--innodb-checksum-algorithm=crc32
-- source include/restart_mysqld.inc
select count(*) from t1;
select count(*) from t2;
select count(*) from t3;
select count(*) from t4;
select count(*) from t5;
insert into t1(b) select b from t1;
insert into t2(b) select b from t1;
insert into t3(b) select b from t1;
insert into t4(b) select b from t1;
insert into t5(b) select b from t1;
--echo # 2 Restart mysqld --innodb-checksum-algorithm=innodb
-- let $restart_parameters=--innodb-checksum-algorithm=innodb
-- source include/restart_mysqld.inc
select count(*) from t1;
select count(*) from t2;
select count(*) from t3;
select count(*) from t4;
select count(*) from t5;
insert into t1(b) select b from t1 limit 100;
insert into t2(b) select b from t1 limit 100;
insert into t3(b) select b from t1 limit 100;
insert into t4(b) select b from t1 limit 100;
insert into t5(b) select b from t1 limit 100;
--echo # 3 Restart mysqld --innodb-checksum-algorithm=none
-- let $restart_parameters=--innodb-checksum-algorithm=none
-- source include/restart_mysqld.inc
select count(*) from t1;
select count(*) from t2;
select count(*) from t3;
select count(*) from t4;
select count(*) from t5;
insert into t1(b) select b from t1 limit 100;
insert into t2(b) select b from t1 limit 100;
insert into t3(b) select b from t1 limit 100;
insert into t4(b) select b from t1 limit 100;
insert into t5(b) select b from t1 limit 100;
--echo # 4 Restart mysqld --innodb-checksum-algorithm=innodb
-- let $restart_parameters=--innodb-checksum-algorithm=innodb
-- source include/restart_mysqld.inc
select count(*) from t1;
select count(*) from t2;
select count(*) from t3;
select count(*) from t4;
select count(*) from t5;
insert into t1(b) select b from t1 limit 100;
insert into t2(b) select b from t1 limit 100;
insert into t3(b) select b from t1 limit 100;
insert into t4(b) select b from t1 limit 100;
insert into t5(b) select b from t1 limit 100;
--echo # 5 Restart mysqld --innodb-checksum-algorithm=strict_innodb
-- let $restart_parameters=--innodb-checksum-algorithm=strict_innodb
-- source include/restart_mysqld.inc
select count(*) from t1;
select count(*) from t2;
select count(*) from t3;
select count(*) from t4;
select count(*) from t5;
insert into t1(b) select b from t1 limit 100;
insert into t2(b) select b from t1 limit 100;
insert into t3(b) select b from t1 limit 100;
insert into t4(b) select b from t1 limit 100;
insert into t5(b) select b from t1 limit 100;
--echo # 6 Restart mysqld --innodb-checksum-algorithm=innodb
-- let $restart_parameters=--innodb-checksum-algorithm=innodb
-- source include/restart_mysqld.inc
select count(*) from t1;
select count(*) from t2;
select count(*) from t3;
select count(*) from t4;
select count(*) from t5;
insert into t1(b) select b from t1 limit 100;
insert into t2(b) select b from t1 limit 100;
insert into t3(b) select b from t1 limit 100;
insert into t4(b) select b from t1 limit 100;
insert into t5(b) select b from t1 limit 100;
--echo # 7 Restart mysqld --innodb-checksum-algorithm=strict_none
-- let $restart_parameters=--innodb-checksum-algorithm=strict_none
-- source include/restart_mysqld.inc
select count(*) from t1;
select count(*) from t2;
select count(*) from t3;
select count(*) from t4;
select count(*) from t5;
insert into t1(b) select b from t1 limit 100;
insert into t2(b) select b from t1 limit 100;
insert into t3(b) select b from t1 limit 100;
insert into t4(b) select b from t1 limit 100;
insert into t5(b) select b from t1 limit 100;
--echo # 8 Restart mysqld --innodb-checksum-algorithm=innodb
-- let $restart_parameters=--innodb-checksum-algorithm=innodb
-- source include/restart_mysqld.inc
select count(*) from t1;
select count(*) from t2;
select count(*) from t3;
select count(*) from t4;
select count(*) from t5;
insert into t1(b) select b from t1 limit 100;
insert into t2(b) select b from t1 limit 100;
insert into t3(b) select b from t1 limit 100;
insert into t4(b) select b from t1 limit 100;
insert into t5(b) select b from t1 limit 100;
--echo # 9 Restart mysqld --innodb-checksum-algorithm=strict_crc32
-- let $restart_parameters=--innodb-checksum-algorithm=strict_crc32
-- source include/restart_mysqld.inc
select count(*) from t1;
select count(*) from t2;
select count(*) from t3;
select count(*) from t4;
select count(*) from t5;
insert into t1(b) select b from t1 limit 100;
insert into t2(b) select b from t1 limit 100;
insert into t3(b) select b from t1 limit 100;
insert into t4(b) select b from t1 limit 100;
insert into t5(b) select b from t1 limit 100;
--echo # 10 Restart mysqld --innodb-checksum-algorithm=innodb
-- let $restart_parameters=--innodb-checksum-algorithm=innodb
-- source include/restart_mysqld.inc
select count(*) from t1;
select count(*) from t2;
select count(*) from t3;
select count(*) from t4;
select count(*) from t5;
insert into t1(b) select b from t1 limit 100;
insert into t2(b) select b from t1 limit 100;
insert into t3(b) select b from t1 limit 100;
insert into t4(b) select b from t1 limit 100;
insert into t5(b) select b from t1 limit 100;
--echo # Restart mysqld --innodb-checksum-algorithm=crc32
-- let $restart_parameters=--innodb-checksum-algorithm=crc32
-- source include/restart_mysqld.inc
select count(*) from t1;
select count(*) from t2;
select count(*) from t3;
select count(*) from t4;
select count(*) from t5;
insert into t1(b) select b from t1 limit 100;
insert into t2(b) select b from t1 limit 100;
insert into t3(b) select b from t1 limit 100;
insert into t4(b) select b from t1 limit 100;
insert into t5(b) select b from t1 limit 100;
--echo # 11 Restart mysqld --innodb-checksum-algorithm=strict_crc32
-- let $restart_parameters=--innodb-checksum-algorithm=strict_crc32
-- source include/restart_mysqld.inc
select count(*) from t1;
select count(*) from t2;
select count(*) from t3;
select count(*) from t4;
select count(*) from t5;
insert into t1(b) select b from t1 limit 100;
insert into t2(b) select b from t1 limit 100;
insert into t3(b) select b from t1 limit 100;
insert into t4(b) select b from t1 limit 100;
insert into t5(b) select b from t1 limit 100;
--echo # 12 Restart mysqld --innodb-checksum-algorithm=crc32
-- let $restart_parameters=--innodb-checksum-algorithm=crc32
-- source include/restart_mysqld.inc
select count(*) from t1;
select count(*) from t2;
select count(*) from t3;
select count(*) from t4;
select count(*) from t5;
insert into t1(b) select b from t1 limit 100;
insert into t2(b) select b from t1 limit 100;
insert into t3(b) select b from t1 limit 100;
insert into t4(b) select b from t1 limit 100;
insert into t5(b) select b from t1 limit 100;
--echo # 13 Restart mysqld --innodb-checksum-algorithm=strict_none
-- let $restart_parameters=--innodb-checksum-algorithm=strict_none
-- source include/restart_mysqld.inc
select count(*) from t1;
select count(*) from t2;
select count(*) from t3;
select count(*) from t4;
select count(*) from t5;
insert into t1(b) select b from t1 limit 100;
insert into t2(b) select b from t1 limit 100;
insert into t3(b) select b from t1 limit 100;
insert into t4(b) select b from t1 limit 100;
insert into t5(b) select b from t1 limit 100;
--echo # 14 Restart mysqld --innodb-checksum-algorithm=crc32
-- let $restart_parameters=--innodb-checksum-algorithm=crc32
-- source include/restart_mysqld.inc
select count(*) from t1;
select count(*) from t2;
select count(*) from t3;
select count(*) from t4;
select count(*) from t5;
insert into t1(b) select b from t1 limit 100;
insert into t2(b) select b from t1 limit 100;
insert into t3(b) select b from t1 limit 100;
insert into t4(b) select b from t1 limit 100;
insert into t5(b) select b from t1 limit 100;
--echo # 15 Restart mysqld --innodb-checksum-algorithm=strict_innodb
-- let $restart_parameters=--innodb-checksum-algorithm=strict_innodb
-- source include/restart_mysqld.inc
select count(*) from t1;
select count(*) from t2;
select count(*) from t3;
select count(*) from t4;
select count(*) from t5;
insert into t1(b) select b from t1 limit 100;
insert into t2(b) select b from t1 limit 100;
insert into t3(b) select b from t1 limit 100;
insert into t4(b) select b from t1 limit 100;
insert into t5(b) select b from t1 limit 100;
--echo # 16 Restart mysqld --innodb-checksum-algorithm=crc32
-- let $restart_parameters=--innodb-checksum-algorithm=crc32
-- source include/restart_mysqld.inc
select count(*) from t1;
select count(*) from t2;
select count(*) from t3;
select count(*) from t4;
select count(*) from t5;
insert into t1(b) select b from t1 limit 100;
insert into t2(b) select b from t1 limit 100;
insert into t3(b) select b from t1 limit 100;
insert into t4(b) select b from t1 limit 100;
insert into t5(b) select b from t1 limit 100;
--echo # 17 Restart mysqld --innodb-checksum-algorithm=none
-- let $restart_parameters=--innodb-checksum-algorithm=none
-- source include/restart_mysqld.inc
select count(*) from t1;
select count(*) from t2;
select count(*) from t3;
select count(*) from t4;
select count(*) from t5;
insert into t1(b) select b from t1 limit 100;
insert into t2(b) select b from t1 limit 100;
insert into t3(b) select b from t1 limit 100;
insert into t4(b) select b from t1 limit 100;
insert into t5(b) select b from t1 limit 100;
--echo # 18 Restart mysqld --innodb-checksum-algorithm=crc32
-- let $restart_parameters=--innodb-checksum-algorithm=crc32
-- source include/restart_mysqld.inc
select count(*) from t1;
select count(*) from t2;
select count(*) from t3;
select count(*) from t4;
select count(*) from t5;
insert into t1(b) select b from t1 limit 100;
insert into t2(b) select b from t1 limit 100;
insert into t3(b) select b from t1 limit 100;
insert into t4(b) select b from t1 limit 100;
insert into t5(b) select b from t1 limit 100;
--echo # Restart mysqld --innodb-checksum-algorithm=strict_crc32
-- let $restart_parameters=--innodb-checksum-algorithm=strict_crc32
-- source include/restart_mysqld.inc
select count(*) from t1;
select count(*) from t2;
select count(*) from t3;
select count(*) from t4;
select count(*) from t5;
insert into t1(b) select b from t1 limit 100;
insert into t2(b) select b from t1 limit 100;
insert into t3(b) select b from t1 limit 100;
insert into t4(b) select b from t1 limit 100;
insert into t5(b) select b from t1 limit 100;
--echo # 19 Restart mysqld --innodb-checksum-algorithm=strict_none
-- let $restart_parameters=--innodb-checksum-algorithm=strict_none
-- source include/restart_mysqld.inc
select count(*) from t1;
select count(*) from t2;
select count(*) from t3;
select count(*) from t4;
select count(*) from t5;
insert into t1(b) select b from t1 limit 100;
insert into t2(b) select b from t1 limit 100;
insert into t3(b) select b from t1 limit 100;
insert into t4(b) select b from t1 limit 100;
insert into t5(b) select b from t1 limit 100;
--echo # 20 Restart mysqld --innodb-checksum-algorithm=strict_crc32
-- let $restart_parameters=--innodb-checksum-algorithm=strict_crc32
-- source include/restart_mysqld.inc
select count(*) from t1;
select count(*) from t2;
select count(*) from t3;
select count(*) from t4;
select count(*) from t5;
insert into t1(b) select b from t1 limit 100;
insert into t2(b) select b from t1 limit 100;
insert into t3(b) select b from t1 limit 100;
insert into t4(b) select b from t1 limit 100;
insert into t5(b) select b from t1 limit 100;
--echo # 21 Restart mysqld --innodb-checksum-algorithm=strict_innodb
-- let $restart_parameters=--innodb-checksum-algorithm=strict_innodb
-- source include/restart_mysqld.inc
select count(*) from t1;
select count(*) from t2;
select count(*) from t3;
select count(*) from t4;
select count(*) from t5;
insert into t1(b) select b from t1 limit 100;
insert into t2(b) select b from t1 limit 100;
insert into t3(b) select b from t1 limit 100;
insert into t4(b) select b from t1 limit 100;
insert into t5(b) select b from t1 limit 100;
--echo # 22 Restart mysqld --innodb-checksum-algorithm=strict_crc32
-- let $restart_parameters=--innodb-checksum-algorithm=strict_crc32
-- source include/restart_mysqld.inc
select count(*) from t1;
select count(*) from t2;
select count(*) from t3;
select count(*) from t4;
select count(*) from t5;
insert into t1(b) select b from t1 limit 100;
insert into t2(b) select b from t1 limit 100;
insert into t3(b) select b from t1 limit 100;
insert into t4(b) select b from t1 limit 100;
insert into t5(b) select b from t1 limit 100;
--echo # 23 Restart mysqld --innodb-checksum-algorithm=none
-- let $restart_parameters=--innodb-checksum-algorithm=none
-- source include/restart_mysqld.inc
select count(*) from t1;
select count(*) from t2;
select count(*) from t3;
select count(*) from t4;
select count(*) from t5;
insert into t1(b) select b from t1 limit 100;
insert into t2(b) select b from t1 limit 100;
insert into t3(b) select b from t1 limit 100;
insert into t4(b) select b from t1 limit 100;
insert into t5(b) select b from t1 limit 100;
--echo # 24 Restart mysqld --innodb-checksum-algorithm=strict_crc32
-- let $restart_parameters=--innodb-checksum-algorithm=strict_crc32
-- source include/restart_mysqld.inc
select count(*) from t1;
select count(*) from t2;
select count(*) from t3;
select count(*) from t4;
select count(*) from t5;
insert into t1(b) select b from t1 limit 100;
insert into t2(b) select b from t1 limit 100;
insert into t3(b) select b from t1 limit 100;
insert into t4(b) select b from t1 limit 100;
insert into t5(b) select b from t1 limit 100;
--echo # Restart mysqld --innodb-checksum-algorithm=strict_none
-- let $restart_parameters=--innodb-checksum-algorithm=strict_none
-- source include/restart_mysqld.inc
select count(*) from t1;
select count(*) from t2;
select count(*) from t3;
select count(*) from t4;
select count(*) from t5;
insert into t1(b) select b from t1 limit 100;
insert into t2(b) select b from t1 limit 100;
insert into t3(b) select b from t1 limit 100;
insert into t4(b) select b from t1 limit 100;
insert into t5(b) select b from t1 limit 100;
--echo # 25 Restart mysqld --innodb-checksum-algorithm=none
-- let $restart_parameters=--innodb-checksum-algorithm=none
-- source include/restart_mysqld.inc
select count(*) from t1;
select count(*) from t2;
select count(*) from t3;
select count(*) from t4;
select count(*) from t5;
insert into t1(b) select b from t1 limit 100;
insert into t2(b) select b from t1 limit 100;
insert into t3(b) select b from t1 limit 100;
insert into t4(b) select b from t1 limit 100;
insert into t5(b) select b from t1 limit 100;
--echo # 26 Restart mysqld --innodb-checksum-algorithm=strict_none
-- let $restart_parameters=--innodb-checksum-algorithm=strict_none
-- source include/restart_mysqld.inc
select count(*) from t1;
select count(*) from t2;
select count(*) from t3;
select count(*) from t4;
select count(*) from t5;
insert into t1(b) select b from t1 limit 100;
insert into t2(b) select b from t1 limit 100;
insert into t3(b) select b from t1 limit 100;
insert into t4(b) select b from t1 limit 100;
insert into t5(b) select b from t1 limit 100;
--echo # 27 Restart mysqld --innodb-checksum-algorithm=strict_innodb
-- let $restart_parameters=--innodb-checksum-algorithm=strict_innodb
-- source include/restart_mysqld.inc
select count(*) from t1;
select count(*) from t2;
select count(*) from t3;
select count(*) from t4;
select count(*) from t5;
insert into t1(b) select b from t1 limit 100;
insert into t2(b) select b from t1 limit 100;
insert into t3(b) select b from t1 limit 100;
insert into t4(b) select b from t1 limit 100;
insert into t5(b) select b from t1 limit 100;
--echo # 28 Restart mysqld --innodb-checksum-algorithm=strict_none
-- let $restart_parameters=--innodb-checksum-algorithm=strict_none
-- source include/restart_mysqld.inc
select count(*) from t1;
select count(*) from t2;
select count(*) from t3;
select count(*) from t4;
select count(*) from t5;
insert into t1(b) select b from t1 limit 100;
insert into t2(b) select b from t1 limit 100;
insert into t3(b) select b from t1 limit 100;
insert into t4(b) select b from t1 limit 100;
insert into t5(b) select b from t1 limit 100;
--echo # Restart mysqld --innodb-checksum-algorithm=none
-- let $restart_parameters=--innodb-checksum-algorithm=none
-- source include/restart_mysqld.inc
select count(*) from t1;
select count(*) from t2;
select count(*) from t3;
select count(*) from t4;
select count(*) from t5;
insert into t1(b) select b from t1 limit 100;
insert into t2(b) select b from t1 limit 100;
insert into t3(b) select b from t1 limit 100;
insert into t4(b) select b from t1 limit 100;
insert into t5(b) select b from t1 limit 100;
--echo # 29 Restart mysqld --innodb-checksum-algorithm=strict_innodb
-- let $restart_parameters=--innodb-checksum-algorithm=strict_innodb
-- source include/restart_mysqld.inc
select count(*) from t1;
select count(*) from t2;
select count(*) from t3;
select count(*) from t4;
select count(*) from t5;
insert into t1(b) select b from t1 limit 100;
insert into t2(b) select b from t1 limit 100;
insert into t3(b) select b from t1 limit 100;
insert into t4(b) select b from t1 limit 100;
insert into t5(b) select b from t1 limit 100;
--echo # 30 Restart mysqld --innodb-checksum-algorithm=none
-- let $restart_parameters=--innodb-checksum-algorithm=none
-- source include/restart_mysqld.inc
select count(*) from t1;
select count(*) from t2;
select count(*) from t3;
select count(*) from t4;
select count(*) from t5;
insert into t1(b) select b from t1 limit 100;
insert into t2(b) select b from t1 limit 100;
insert into t3(b) select b from t1 limit 100;
insert into t4(b) select b from t1 limit 100;
insert into t5(b) select b from t1 limit 100;
drop table t1,t2,t3,t4,t5;
[crc32]
loose-innodb-tablespaces-encryption
loose-innodb-encrypt-tables=on
loose-innodb-encryption-threads=4
max_allowed_packet=64K
loose-innodb-checksum-algorithm=crc32
[none]
loose-innodb-tablespaces-encryption
loose-innodb-encrypt-tables=on
loose-innodb-encryption-threads=4
max_allowed_packet=64K
loose-innodb-checksum-algorithm=none
...@@ -5,10 +5,8 @@ ...@@ -5,10 +5,8 @@
-- source include/not_embedded.inc -- source include/not_embedded.inc
call mtr.add_suppression("InnoDB: However key management plugin or used key_version .*"); call mtr.add_suppression("InnoDB: However key management plugin or used key_version .*");
call mtr.add_suppression("InnoDB: The page \[page id: space=[0-9]+, page number=[0-9]+\] in file test/t1 cannot be decrypted."); call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[0-9]+\\] in file test/t[1-3] cannot be decrypted.");
call mtr.add_suppression("InnoDB: The page \[page id: space=[0-9]+, page number=[0-9]+\] in file test/t2 cannot be decrypted."); call mtr.add_suppression("Unable to decompress space ..test.t[1-3].ibd \\[[1-9][0-9]*:[0-9]+\\]");
call mtr.add_suppression("InnoDB: The page \[page id: space=[0-9]+, page number=[0-9]+\] in file test/t3 cannot be decrypted.");
--echo # Restart mysqld --file-key-management-filename=keys2.txt --echo # Restart mysqld --file-key-management-filename=keys2.txt
-- let $restart_parameters=--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys2.txt -- let $restart_parameters=--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys2.txt
......
...@@ -354,6 +354,15 @@ bool ...@@ -354,6 +354,15 @@ bool
buf_page_decrypt_after_read(buf_page_t* bpage, fil_space_t* space) buf_page_decrypt_after_read(buf_page_t* bpage, fil_space_t* space)
MY_ATTRIBUTE((nonnull)); MY_ATTRIBUTE((nonnull));
/********************************************************************//**
Mark a table with the specified space pointed by bpage->space corrupted.
Also remove the bpage from LRU list.
@param[in,out] bpage Block */
static
void
buf_mark_space_corrupt(
buf_page_t* bpage);
/* prototypes for new functions added to ha_innodb.cc */ /* prototypes for new functions added to ha_innodb.cc */
trx_t* innobase_get_trx(); trx_t* innobase_get_trx();
...@@ -2526,17 +2535,26 @@ buf_zip_decompress( ...@@ -2526,17 +2535,26 @@ buf_zip_decompress(
{ {
const byte* frame = block->page.zip.data; const byte* frame = block->page.zip.data;
ulint size = page_zip_get_size(&block->page.zip); ulint size = page_zip_get_size(&block->page.zip);
/* Space is not found if this function is called during IMPORT */
fil_space_t* space = fil_space_acquire_for_io(block->page.space);
const unsigned key_version = mach_read_from_4(frame +
FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION);
fil_space_crypt_t* crypt_data = space ? space->crypt_data : NULL;
const bool encrypted = crypt_data
&& crypt_data->type != CRYPT_SCHEME_UNENCRYPTED
&& (!crypt_data->is_default_encryption()
|| srv_encrypt_tables);
ut_ad(buf_block_get_zip_size(block)); ut_ad(buf_block_get_zip_size(block));
ut_a(buf_block_get_space(block) != 0); ut_a(buf_block_get_space(block) != 0);
if (UNIV_UNLIKELY(check && !page_zip_verify_checksum(frame, size))) { if (UNIV_UNLIKELY(check && !page_zip_verify_checksum(frame, size))) {
ut_print_timestamp(stderr); ib_logf(IB_LOG_LEVEL_ERROR,
fprintf(stderr, "Compressed page checksum mismatch"
" InnoDB: compressed page checksum mismatch" " for %s [%u:%u]: stored: " ULINTPF ", crc32: " ULINTPF
" (space %u page %u): stored: %lu, crc32: %lu " " innodb: " ULINTPF ", none: " ULINTPF ".",
"innodb: %lu, none: %lu\n", space ? space->chain.start->name : "N/A",
block->page.space, block->page.offset, block->page.space, block->page.offset,
mach_read_from_4(frame + FIL_PAGE_SPACE_OR_CHKSUM), mach_read_from_4(frame + FIL_PAGE_SPACE_OR_CHKSUM),
page_zip_calc_checksum(frame, size, page_zip_calc_checksum(frame, size,
...@@ -2545,22 +2563,28 @@ buf_zip_decompress( ...@@ -2545,22 +2563,28 @@ buf_zip_decompress(
SRV_CHECKSUM_ALGORITHM_INNODB), SRV_CHECKSUM_ALGORITHM_INNODB),
page_zip_calc_checksum(frame, size, page_zip_calc_checksum(frame, size,
SRV_CHECKSUM_ALGORITHM_NONE)); SRV_CHECKSUM_ALGORITHM_NONE));
return(FALSE); goto err_exit;
} }
switch (fil_page_get_type(frame)) { switch (fil_page_get_type(frame)) {
case FIL_PAGE_INDEX: case FIL_PAGE_INDEX: {
if (page_zip_decompress(&block->page.zip, if (page_zip_decompress(&block->page.zip,
block->frame, TRUE)) { block->frame, TRUE)) {
if (space) {
fil_space_release_for_io(space);
}
return(TRUE); return(TRUE);
} }
fprintf(stderr, ib_logf(IB_LOG_LEVEL_ERROR,
"InnoDB: unable to decompress space %u page %u\n", "Unable to decompress space %s [%u:%u]",
space ? space->chain.start->name : "N/A",
block->page.space, block->page.space,
block->page.offset); block->page.offset);
return(FALSE);
goto err_exit;
}
case FIL_PAGE_TYPE_ALLOCATED: case FIL_PAGE_TYPE_ALLOCATED:
case FIL_PAGE_INODE: case FIL_PAGE_INODE:
case FIL_PAGE_IBUF_BITMAP: case FIL_PAGE_IBUF_BITMAP:
...@@ -2571,14 +2595,36 @@ buf_zip_decompress( ...@@ -2571,14 +2595,36 @@ buf_zip_decompress(
/* Copy to uncompressed storage. */ /* Copy to uncompressed storage. */
memcpy(block->frame, frame, memcpy(block->frame, frame,
buf_block_get_zip_size(block)); buf_block_get_zip_size(block));
if (space) {
fil_space_release_for_io(space);
}
return(TRUE); return(TRUE);
} }
ut_print_timestamp(stderr); ib_logf(IB_LOG_LEVEL_ERROR,
fprintf(stderr, "Unknown compressed page in %s [%u:%u]"
" InnoDB: unknown compressed page" " type %s [" ULINTPF "].",
" type %lu\n", space ? space->chain.start->name : "N/A",
fil_page_get_type(frame)); block->page.space, block->page.offset,
fil_get_page_type_name(fil_page_get_type(frame)), fil_page_get_type(frame));
err_exit:
if (encrypted) {
ib_logf(IB_LOG_LEVEL_INFO,
"Row compressed page could be encrypted with key_version %u.",
key_version);
block->page.encrypted = true;
dict_set_encrypted_by_space(block->page.space);
} else {
dict_set_corrupted_by_space(block->page.space);
}
if (space) {
fil_space_release_for_io(space);
}
return(FALSE); return(FALSE);
} }
...@@ -3031,9 +3077,9 @@ buf_page_get_gen( ...@@ -3031,9 +3077,9 @@ buf_page_get_gen(
} }
ib_logf(IB_LOG_LEVEL_FATAL, "Unable" ib_logf(IB_LOG_LEVEL_FATAL, "Unable"
" to read tablespace %lu page no" " to read tablespace " ULINTPF " page no "
" %lu into the buffer pool after" ULINTPF " into the buffer pool after "
" %lu attempts" ULINTPF " attempts."
" The most probable cause" " The most probable cause"
" of this error may be that the" " of this error may be that the"
" table has been corrupted." " table has been corrupted."
...@@ -3232,12 +3278,21 @@ buf_page_get_gen( ...@@ -3232,12 +3278,21 @@ buf_page_get_gen(
/* Decompress the page while not holding /* Decompress the page while not holding
buf_pool->mutex or block->mutex. */ buf_pool->mutex or block->mutex. */
/* Page checksum verification is already done when
the page is read from disk. Hence page checksum
verification is not necessary when decompressing the page. */
{ {
bool success = buf_zip_decompress(block, FALSE); bool success = buf_zip_decompress(block, TRUE);
ut_a(success);
if (!success) {
buf_pool_mutex_enter(buf_pool);
buf_block_mutex_enter(fix_block);
buf_block_set_io_fix(fix_block, BUF_IO_NONE);
buf_block_mutex_exit(fix_block);
--buf_pool->n_pend_unzip;
buf_block_unfix(fix_block);
buf_pool_mutex_exit(buf_pool);
rw_lock_x_unlock(&fix_block->lock);
return NULL;
}
} }
if (!recv_no_ibuf_operations) { if (!recv_no_ibuf_operations) {
......
...@@ -887,7 +887,7 @@ fil_space_decrypt( ...@@ -887,7 +887,7 @@ fil_space_decrypt(
Calculate post encryption checksum Calculate post encryption checksum
@param[in] zip_size zip_size or 0 @param[in] zip_size zip_size or 0
@param[in] dst_frame Block where checksum is calculated @param[in] dst_frame Block where checksum is calculated
@return page checksum or BUF_NO_CHECKSUM_MAGIC @return page checksum
not needed. */ not needed. */
UNIV_INTERN UNIV_INTERN
ulint ulint
...@@ -896,30 +896,13 @@ fil_crypt_calculate_checksum( ...@@ -896,30 +896,13 @@ fil_crypt_calculate_checksum(
const byte* dst_frame) const byte* dst_frame)
{ {
ib_uint32_t checksum = 0; ib_uint32_t checksum = 0;
srv_checksum_algorithm_t algorithm =
static_cast<srv_checksum_algorithm_t>(srv_checksum_algorithm);
/* For encrypted tables we use only crc32 and strict_crc32 */
if (zip_size == 0) { if (zip_size == 0) {
switch (algorithm) { checksum = buf_calc_page_crc32(dst_frame);
case SRV_CHECKSUM_ALGORITHM_CRC32:
case SRV_CHECKSUM_ALGORITHM_STRICT_CRC32:
checksum = buf_calc_page_crc32(dst_frame);
break;
case SRV_CHECKSUM_ALGORITHM_INNODB:
case SRV_CHECKSUM_ALGORITHM_STRICT_INNODB:
checksum = (ib_uint32_t) buf_calc_page_new_checksum(
dst_frame);
break;
case SRV_CHECKSUM_ALGORITHM_NONE:
case SRV_CHECKSUM_ALGORITHM_STRICT_NONE:
checksum = BUF_NO_CHECKSUM_MAGIC;
break;
/* no default so the compiler will emit a warning
* if new enum is added and not handled here */
}
} else { } else {
checksum = page_zip_calc_checksum(dst_frame, zip_size, checksum = page_zip_calc_checksum(dst_frame, zip_size,
algorithm); SRV_CHECKSUM_ALGORITHM_CRC32);
} }
return checksum; return checksum;
...@@ -953,14 +936,6 @@ fil_space_verify_crypt_checksum( ...@@ -953,14 +936,6 @@ fil_space_verify_crypt_checksum(
return(false); return(false);
} }
srv_checksum_algorithm_t algorithm =
static_cast<srv_checksum_algorithm_t>(srv_checksum_algorithm);
/* If no checksum is used, can't continue checking. */
if (algorithm == SRV_CHECKSUM_ALGORITHM_NONE) {
return(true);
}
/* Read stored post encryption checksum. */ /* Read stored post encryption checksum. */
ib_uint32_t checksum = mach_read_from_4( ib_uint32_t checksum = mach_read_from_4(
page + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION + 4); page + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION + 4);
...@@ -1044,7 +1019,6 @@ fil_space_verify_crypt_checksum( ...@@ -1044,7 +1019,6 @@ fil_space_verify_crypt_checksum(
checksum2 = mach_read_from_4( checksum2 = mach_read_from_4(
page + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM); page + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM);
valid = (buf_page_is_checksum_valid_crc32(page,checksum1,checksum2) valid = (buf_page_is_checksum_valid_crc32(page,checksum1,checksum2)
|| buf_page_is_checksum_valid_none(page,checksum1,checksum2)
|| buf_page_is_checksum_valid_innodb(page,checksum1, checksum2)); || buf_page_is_checksum_valid_innodb(page,checksum1, checksum2));
} }
......
...@@ -86,6 +86,15 @@ bool ...@@ -86,6 +86,15 @@ bool
buf_page_decrypt_after_read(buf_page_t* bpage, fil_space_t* space) buf_page_decrypt_after_read(buf_page_t* bpage, fil_space_t* space)
MY_ATTRIBUTE((nonnull)); MY_ATTRIBUTE((nonnull));
/********************************************************************//**
Mark a table with the specified space pointed by bpage->space corrupted.
Also remove the bpage from LRU list.
@param[in,out] bpage Block */
static
void
buf_mark_space_corrupt(
buf_page_t* bpage);
/* prototypes for new functions added to ha_innodb.cc */ /* prototypes for new functions added to ha_innodb.cc */
trx_t* innobase_get_trx(); trx_t* innobase_get_trx();
...@@ -2538,17 +2547,26 @@ buf_zip_decompress( ...@@ -2538,17 +2547,26 @@ buf_zip_decompress(
{ {
const byte* frame = block->page.zip.data; const byte* frame = block->page.zip.data;
ulint size = page_zip_get_size(&block->page.zip); ulint size = page_zip_get_size(&block->page.zip);
/* Space is not found if this function is called during IMPORT */
fil_space_t* space = fil_space_acquire_for_io(block->page.space);
const unsigned key_version = mach_read_from_4(frame +
FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION);
fil_space_crypt_t* crypt_data = space ? space->crypt_data : NULL;
const bool encrypted = crypt_data
&& crypt_data->type != CRYPT_SCHEME_UNENCRYPTED
&& (!crypt_data->is_default_encryption()
|| srv_encrypt_tables);
ut_ad(buf_block_get_zip_size(block)); ut_ad(buf_block_get_zip_size(block));
ut_a(buf_block_get_space(block) != 0); ut_a(buf_block_get_space(block) != 0);
if (UNIV_UNLIKELY(check && !page_zip_verify_checksum(frame, size))) { if (UNIV_UNLIKELY(check && !page_zip_verify_checksum(frame, size))) {
ut_print_timestamp(stderr); ib_logf(IB_LOG_LEVEL_ERROR,
fprintf(stderr, "Compressed page checksum mismatch"
" InnoDB: compressed page checksum mismatch" " for %s [%u:%u]: stored: " ULINTPF ", crc32: " ULINTPF
" (space %u page %u): stored: %lu, crc32: %lu " " innodb: " ULINTPF ", none: " ULINTPF ".",
"innodb: %lu, none: %lu\n", space ? space->chain.start->name : "N/A",
block->page.space, block->page.offset, block->page.space, block->page.offset,
mach_read_from_4(frame + FIL_PAGE_SPACE_OR_CHKSUM), mach_read_from_4(frame + FIL_PAGE_SPACE_OR_CHKSUM),
page_zip_calc_checksum(frame, size, page_zip_calc_checksum(frame, size,
...@@ -2557,22 +2575,28 @@ buf_zip_decompress( ...@@ -2557,22 +2575,28 @@ buf_zip_decompress(
SRV_CHECKSUM_ALGORITHM_INNODB), SRV_CHECKSUM_ALGORITHM_INNODB),
page_zip_calc_checksum(frame, size, page_zip_calc_checksum(frame, size,
SRV_CHECKSUM_ALGORITHM_NONE)); SRV_CHECKSUM_ALGORITHM_NONE));
return(FALSE); goto err_exit;
} }
switch (fil_page_get_type(frame)) { switch (fil_page_get_type(frame)) {
case FIL_PAGE_INDEX: case FIL_PAGE_INDEX: {
if (page_zip_decompress(&block->page.zip, if (page_zip_decompress(&block->page.zip,
block->frame, TRUE)) { block->frame, TRUE)) {
if (space) {
fil_space_release_for_io(space);
}
return(TRUE); return(TRUE);
} }
fprintf(stderr, ib_logf(IB_LOG_LEVEL_ERROR,
"InnoDB: unable to decompress space %u page %u\n", "Unable to decompress space %s [%u:%u]",
space ? space->chain.start->name : "N/A",
block->page.space, block->page.space,
block->page.offset); block->page.offset);
return(FALSE);
goto err_exit;
}
case FIL_PAGE_TYPE_ALLOCATED: case FIL_PAGE_TYPE_ALLOCATED:
case FIL_PAGE_INODE: case FIL_PAGE_INODE:
case FIL_PAGE_IBUF_BITMAP: case FIL_PAGE_IBUF_BITMAP:
...@@ -2583,14 +2607,36 @@ buf_zip_decompress( ...@@ -2583,14 +2607,36 @@ buf_zip_decompress(
/* Copy to uncompressed storage. */ /* Copy to uncompressed storage. */
memcpy(block->frame, frame, memcpy(block->frame, frame,
buf_block_get_zip_size(block)); buf_block_get_zip_size(block));
if (space) {
fil_space_release_for_io(space);
}
return(TRUE); return(TRUE);
} }
ut_print_timestamp(stderr); ib_logf(IB_LOG_LEVEL_ERROR,
fprintf(stderr, "Unknown compressed page in %s [%u:%u]"
" InnoDB: unknown compressed page" " type %s [" ULINTPF "].",
" type %lu\n", space ? space->chain.start->name : "N/A",
fil_page_get_type(frame)); block->page.space, block->page.offset,
fil_get_page_type_name(fil_page_get_type(frame)), fil_page_get_type(frame));
err_exit:
if (encrypted) {
ib_logf(IB_LOG_LEVEL_INFO,
"Row compressed page could be encrypted with key_version %u.",
key_version);
block->page.encrypted = true;
dict_set_encrypted_by_space(block->page.space);
} else {
dict_set_corrupted_by_space(block->page.space);
}
if (space) {
fil_space_release_for_io(space);
}
return(FALSE); return(FALSE);
} }
...@@ -3073,9 +3119,9 @@ buf_page_get_gen( ...@@ -3073,9 +3119,9 @@ buf_page_get_gen(
} }
ib_logf(IB_LOG_LEVEL_FATAL, "Unable" ib_logf(IB_LOG_LEVEL_FATAL, "Unable"
" to read tablespace %lu page no" " to read tablespace " ULINTPF " page no "
" %lu into the buffer pool after" ULINTPF " into the buffer pool after "
" %lu attempts" ULINTPF " attempts."
" The most probable cause" " The most probable cause"
" of this error may be that the" " of this error may be that the"
" table has been corrupted." " table has been corrupted."
...@@ -3288,12 +3334,21 @@ buf_page_get_gen( ...@@ -3288,12 +3334,21 @@ buf_page_get_gen(
/* Decompress the page while not holding /* Decompress the page while not holding
any buf_pool or block->mutex. */ any buf_pool or block->mutex. */
/* Page checksum verification is already done when
the page is read from disk. Hence page checksum
verification is not necessary when decompressing the page. */
{ {
bool success = buf_zip_decompress(block, FALSE); bool success = buf_zip_decompress(block, TRUE);
ut_a(success);
if (!success) {
buf_block_mutex_enter(fix_block);
buf_block_set_io_fix(fix_block, BUF_IO_NONE);
buf_block_mutex_exit(fix_block);
os_atomic_decrement_ulint(&buf_pool->n_pend_unzip, 1);
rw_lock_x_unlock(&fix_block->lock);
mutex_enter(&buf_pool->LRU_list_mutex);
buf_block_unfix(fix_block);
mutex_exit(&buf_pool->LRU_list_mutex);
return NULL;
}
} }
if (!recv_no_ibuf_operations) { if (!recv_no_ibuf_operations) {
......
...@@ -887,7 +887,7 @@ fil_space_decrypt( ...@@ -887,7 +887,7 @@ fil_space_decrypt(
Calculate post encryption checksum Calculate post encryption checksum
@param[in] zip_size zip_size or 0 @param[in] zip_size zip_size or 0
@param[in] dst_frame Block where checksum is calculated @param[in] dst_frame Block where checksum is calculated
@return page checksum or BUF_NO_CHECKSUM_MAGIC @return page checksum
not needed. */ not needed. */
UNIV_INTERN UNIV_INTERN
ulint ulint
...@@ -896,30 +896,13 @@ fil_crypt_calculate_checksum( ...@@ -896,30 +896,13 @@ fil_crypt_calculate_checksum(
const byte* dst_frame) const byte* dst_frame)
{ {
ib_uint32_t checksum = 0; ib_uint32_t checksum = 0;
srv_checksum_algorithm_t algorithm =
static_cast<srv_checksum_algorithm_t>(srv_checksum_algorithm);
/* For encrypted tables we use only crc32 and strict_crc32 */
if (zip_size == 0) { if (zip_size == 0) {
switch (algorithm) { checksum = buf_calc_page_crc32(dst_frame);
case SRV_CHECKSUM_ALGORITHM_CRC32:
case SRV_CHECKSUM_ALGORITHM_STRICT_CRC32:
checksum = buf_calc_page_crc32(dst_frame);
break;
case SRV_CHECKSUM_ALGORITHM_INNODB:
case SRV_CHECKSUM_ALGORITHM_STRICT_INNODB:
checksum = (ib_uint32_t) buf_calc_page_new_checksum(
dst_frame);
break;
case SRV_CHECKSUM_ALGORITHM_NONE:
case SRV_CHECKSUM_ALGORITHM_STRICT_NONE:
checksum = BUF_NO_CHECKSUM_MAGIC;
break;
/* no default so the compiler will emit a warning
* if new enum is added and not handled here */
}
} else { } else {
checksum = page_zip_calc_checksum(dst_frame, zip_size, checksum = page_zip_calc_checksum(dst_frame, zip_size,
algorithm); SRV_CHECKSUM_ALGORITHM_CRC32);
} }
return checksum; return checksum;
...@@ -953,14 +936,6 @@ fil_space_verify_crypt_checksum( ...@@ -953,14 +936,6 @@ fil_space_verify_crypt_checksum(
return(false); return(false);
} }
srv_checksum_algorithm_t algorithm =
static_cast<srv_checksum_algorithm_t>(srv_checksum_algorithm);
/* If no checksum is used, can't continue checking. */
if (algorithm == SRV_CHECKSUM_ALGORITHM_NONE) {
return(true);
}
/* Read stored post encryption checksum. */ /* Read stored post encryption checksum. */
ib_uint32_t checksum = mach_read_from_4( ib_uint32_t checksum = mach_read_from_4(
page + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION + 4); page + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION + 4);
...@@ -1044,7 +1019,6 @@ fil_space_verify_crypt_checksum( ...@@ -1044,7 +1019,6 @@ fil_space_verify_crypt_checksum(
checksum1 = mach_read_from_4( checksum1 = mach_read_from_4(
page + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM); page + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM);
valid = (buf_page_is_checksum_valid_crc32(page,checksum1,checksum2) valid = (buf_page_is_checksum_valid_crc32(page,checksum1,checksum2)
|| buf_page_is_checksum_valid_none(page,checksum1,checksum2)
|| buf_page_is_checksum_valid_innodb(page,checksum1, checksum2)); || buf_page_is_checksum_valid_innodb(page,checksum1, checksum2));
} }
......
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