Debian Codegraph @

mysql-test/suite/encryption/t/innodb-redo-nokeys.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
6 call mtr.add_suppression("mariadbd.*: File ");
7 call mtr.add_suppression("Plugin 'file_key_management' ");
8 call mtr.add_suppression("InnoDB: Recovery cannot access file");
9 call mtr.add_suppression("InnoDB: Plugin initialization aborted");
10 call mtr.add_suppression("Plugin 'InnoDB' init function returned error\\.");
11 call mtr.add_suppression("Plugin 'InnoDB' registration as a STORAGE ENGINE failed.");
12 call mtr.add_suppression("Fewer engines are enabled now than were before the crash");
13 call mtr.add_suppression("InnoDB: (Unable to apply log to|Discarding log for) corrupted page ");
14 call mtr.add_suppression("InnoDB: Cannot apply log to \\[page id: space=[1-9][0-9]*, page number=0\\] of corrupted file '.*test.t[1-5]\\.ibd'");
15 call mtr.add_suppression("InnoDB: Failed to read page .* from file '.*'");
16 call mtr.add_suppression("InnoDB: OPT_PAGE_CHECKSUM mismatch");
17 call mtr.add_suppression("InnoDB: Missing FILE_CHECKPOINT");
18 call mtr.add_suppression("InnoDB: Log scan aborted at LSN");
19 call mtr.add_suppression("InnoDB: Set innodb_force_recovery=1 to ignore corruption");
20 call mtr.add_suppression("InnoDB: Encryption key is not found for");
21
22 -- let $restart_parameters=--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys2.txt
23 -- source include/restart_mysqld.inc
24
25 create table t1(a int not null primary key auto_increment, c char(200), b blob, index(b(10))) engine=innodb row_format=compressed encrypted=yes encryption_key_id=20;
26 create table t2(a int not null primary key auto_increment, c char(200), b blob, index(b(10))) engine=innodb row_format=compressed encrypted=yes;
27 create table t3(a int not null primary key auto_increment, c char(200), b blob, index(b(10))) engine=innodb encrypted=yes encryption_key_id=20;
28 create table t4(a int not null primary key auto_increment, c char(200), b blob, index(b(10))) engine=innodb encrypted=yes;
29
30 begin;
31 --disable_query_log
32 --let $i = 20
33 begin;
34 while ($i)
35 {
36 insert into t1(c,b) values (repeat('secret1',20), repeat('secret2',6000));
37 dec $i;
38 }
39 --enable_query_log
40
41 insert into t2 select * from t1;
42 insert into t3 select * from t1;
43 insert into t4 select * from t1;
44 commit;
45
46 let $no_checkpoint_flush= 1;
47 --source ../../suite/innodb/include/no_checkpoint_start.inc
48
49 #
50 # We test redo log page read at recv_read_page using
51 # keys that are not in std_data/keys.txt. If checkpoint
52 # happens we will skip this test. If no checkpoint
53 # happens, InnoDB refuses to start as used
54 # encryption key is not found.
55 #
56 CREATE TABLE t5 (a VARCHAR(8)) ENGINE=InnoDB ENCRYPTED=YES;
57 SET GLOBAL innodb_flush_log_at_trx_commit=1;
58 begin;
59 update t1 set c = repeat('secret3', 20);
60 update t2 set c = repeat('secret4', 20);
61 update t3 set c = repeat('secret4', 20);
62 update t4 set c = repeat('secret4', 20);
63 insert into t1 (c,b) values (repeat('secret5',20), repeat('secret6',6000));
64 insert into t2 (c,b) values (repeat('secret7',20), repeat('secret8',6000));
65 insert into t3 (c,b) values (repeat('secret9',20), repeat('secre10',6000));
66 insert into t4 (c,b) values (repeat('secre11',20), repeat('secre12',6000));
67 INSERT INTO t5 VALUES ('foo'),('bar');
68 COMMIT;
69
70 let $cleanup= drop table t1,t2,t3,t4,t5;
71 --let CLEANUP_IF_CHECKPOINT= $cleanup;
72 --source ../../suite/innodb/include/no_checkpoint_end.inc
73
74 -- let $restart_parameters=--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys-not-found.txt
75 -- source include/start_mysqld.inc
76 SELECT * FROM INFORMATION_SCHEMA.ENGINES
77 WHERE engine = 'innodb'
78 AND support IN ('YES', 'DEFAULT', 'ENABLED');
79
80 let SEARCH_FILE = $MYSQLTEST_VARDIR/log/mysqld.1.err;
81 let SEARCH_PATTERN = \[ERROR\] InnoDB: Encryption key is not found for .*test.t[1-5].ibd;
82 --source include/search_pattern_in_file.inc
83
84 #
85 # In above server does start but InnoDB refuses to start
86 # thus we need to restart server with correct key file
87 #
88 -- let $restart_parameters=--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys2.txt
89 -- source include/restart_mysqld.inc
90
91 drop table t1,t2,t3,t4,t5;