Debian Codegraph @

mysql-test/suite/encryption/t/innodb-redo-badkey.test

raw
1 -- source include/have_innodb.inc
2 -- source include/have_file_key_management_plugin.inc
3 # embedded does not support restart
4 -- source include/not_embedded.inc
5 # MDEV-20839 innodb-redo-badkey sporadically fails on buildbot with page dump
6 # We only require a debug build to avoid getting page dumps, making use of
7 # MDEV-19766: Disable page dump output in debug builds
8 -- source include/have_debug.inc
9
10 call mtr.add_suppression("Plugin 'file_key_management'");
11 call mtr.add_suppression("Plugin 'InnoDB' init function returned error.");
12 call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[1-4]\\.ibd' cannot be decrypted; key_version=1");
13 call mtr.add_suppression("InnoDB: File '.*test/t[1234]\\.ibd' is corrupted");
14 call mtr.add_suppression("InnoDB: Recovery failed to read page");
15 call mtr.add_suppression("InnoDB: Unable to decompress .*.test.t[12]\\.ibd\\[page id: space=[1-9][0-9]*, page number=[0-9]+\\]");
16 call mtr.add_suppression("InnoDB: Database page corruption on disk or a failed read of file '.*test.t[12]\\.ibd'");
17 call mtr.add_suppression("InnoDB: Failed to read page .* from file '.*'");
18 call mtr.add_suppression("InnoDB: OPT_PAGE_CHECKSUM mismatch");
19 call mtr.add_suppression("InnoDB: Set innodb_force_recovery=1 to ignore corruption");
20 call mtr.add_suppression("InnoDB: (Unable to apply log to|Discarding log for) corrupted page ");
21 call mtr.add_suppression("InnoDB: Plugin initialization aborted");
22 call mtr.add_suppression("Plugin 'InnoDB' registration as a STORAGE ENGINE failed");
23 # for innodb_checksum_algorithm=full_crc32 only
24 call mtr.add_suppression("\\[ERROR\\] InnoDB: Cannot decrypt \\[page id: space=");
25
26 -- let $restart_parameters=--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys2.txt
27 -- source include/restart_mysqld.inc
28
29 --echo # Wait max 10 min for key encryption threads to encrypt all spaces
30 --let $wait_timeout= 600
31 --let $wait_condition=SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0
32 --source include/wait_condition.inc
33
34 create table t1(a int not null primary key auto_increment, c char(250), b blob, index(b(10))) engine=innodb row_format=compressed encrypted=yes encryption_key_id=4;
35 create table t2(a int not null primary key auto_increment, c char(250), b blob, index(b(10))) engine=innodb row_format=compressed;
36 create table t3(a int not null primary key auto_increment, c char(250), b blob, index(b(10))) engine=innodb encrypted=yes encryption_key_id=4;
37 create table t4(a int not null primary key auto_increment, c char(250), b blob, index(b(10))) engine=innodb;
38
39 begin;
40 --disable_query_log
41 --let $i = 20
42 begin;
43 while ($i)
44 {
45 insert into t1(c,b) values (repeat('secret1',20), repeat('secret2',6000));
46 dec $i;
47 }
48 --enable_query_log
49
50 insert into t2 select * from t1;
51 insert into t3 select * from t1;
52 insert into t4 select * from t1;
53 commit;
54
55 set global innodb_log_checkpoint_now=on;
56
57 --source ../../suite/innodb/include/no_checkpoint_start.inc
58
59 #
60 # We test redo log page read at recv_read_page using
61 # incorrect keys from std_data/keys.txt. If checkpoint
62 # happens we will skip this test. If no checkpoint
63 # happens, InnoDB refuses to start as used
64 # encryption key is incorrect.
65 #
66 SET GLOBAL innodb_flush_log_at_trx_commit=1;
67 begin;
68 update t1 set c = repeat('secret3', 20);
69 update t2 set c = repeat('secret4', 20);
70 update t3 set c = repeat('secret4', 20);
71 update t4 set c = repeat('secret4', 20);
72 insert into t1 (c,b) values (repeat('secret5',20), repeat('secret6',6000));
73 insert into t2 (c,b) values (repeat('secret7',20), repeat('secret8',6000));
74 insert into t3 (c,b) values (repeat('secret9',20), repeat('secre10',6000));
75 insert into t4 (c,b) values (repeat('secre11',20), repeat('secre12',6000));
76 COMMIT;
77 let $cleanup= drop table t1,t2,t3,t4;
78 --let CLEANUP_IF_CHECKPOINT= $cleanup;
79 --source ../../suite/innodb/include/no_checkpoint_end.inc
80
81 --error 1
82 -- source include/start_mysqld.inc
83 --source include/kill_mysqld.inc
84
85 #
86 # Now test with innodb-force-recovery=1 i.e. ignore corrupt pages
87 #
88
89 -- let $restart_parameters=--innodb-force-recovery=1
90 --error 1
91 -- source include/start_mysqld.inc
92
93 --source include/kill_mysqld.inc
94
95 -- let $restart_parameters=--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys2.txt
96 -- source include/start_mysqld.inc
97
98 drop table t1, t2,t3,t4;