Debian Codegraph @

mysql-test/suite/encryption/t/innodb-bad-key-change.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 #
7 # MDEV-8588: Assertion failure in file ha_innodb.cc line 21140 if at least one encrypted
8 # table exists and encryption service is not available.
9 #
10
11 call mtr.add_suppression("Plugin 'file_key_management' init function returned error");
12 call mtr.add_suppression("Plugin 'file_key_management' registration.*failed");
13 call mtr.add_suppression("InnoDB: Table `test`\\.`t[12]` has an unreadable root page");
14 call mtr.add_suppression("Table .*t[12].* is corrupted");
15 call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[12]\\.ibd' cannot be decrypted; key_version=1");
16 call mtr.add_suppression("InnoDB: Failed to read page [1-9][0-9]* from file '.*test/t[12]\\.ibd'");
17 call mtr.add_suppression("InnoDB: Encrypted page \\[page id: space=[1-9][0-9]*, page number=3\\] in file .*test.t1.ibd looks corrupted; key_version=1");
18 call mtr.add_suppression("InnoDB: File '.*test/t[12]\\.ibd' is corrupted");
19 call mtr.add_suppression("Table `test`\\.`t[12]` is corrupted");
20 call mtr.add_suppression("File '.*mysql-test.std_data.keysbad3\\.txt' not found");
21 call mtr.add_suppression("File '.*mariadb-test.std_data.keysbad3\\.txt' not found");
22 # for innodb_checksum_algorithm=full_crc32 only
23 call mtr.add_suppression("\\[ERROR\\] InnoDB: Cannot decrypt \\[page id: space=");
24
25 --echo # Start server with keys2.txt
26 -- let $restart_parameters=--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys2.txt
27 -- source include/restart_mysqld.inc
28
29 CREATE TABLE t1 (c VARCHAR(8)) ENGINE=InnoDB ENCRYPTED=YES ENCRYPTION_KEY_ID=2;
30 INSERT INTO t1 VALUES ('foobar');
31 ALTER TABLE t1 ADD COLUMN c2 INT;
32 INSERT INTO t1 VALUES ('foobar',2);
33 SELECT * FROM t1;
34 TRUNCATE TABLE t1;
35 SELECT * FROM t1;
36 INSERT INTO t1 VALUES ('foobar',1);
37 INSERT INTO t1 VALUES ('foobar',2);
38 FLUSH TABLE WITH READ LOCK;
39 SELECT * FROM t1;
40
41 --echo
42 --echo # Restart server with keysbad3.txt
43 -- let $restart_parameters=--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keysbad3.txt
44 -- source include/restart_mysqld.inc
45
46 --disable_warnings
47 --error ER_TABLE_CORRUPT
48 SELECT * FROM t1;
49 --enable_warnings
50
51 -- let $restart_parameters=--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keysbad3.txt
52 -- source include/restart_mysqld.inc
53
54 --replace_regex /key_id [1-9][0-9]*/\1 /
55 DROP TABLE t1;
56
57 #
58 # MDEV-8591: Database page corruption on disk or a failed space, Assertion failure in file buf0buf.cc
59 # line 2856 on querying a table using wrong default encryption key
60 #
61
62 --echo # Start server with keys3.txt
63 -- let $restart_parameters=--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys3.txt
64 -- source include/restart_mysqld.inc
65
66 SET GLOBAL innodb_default_encryption_key_id=5;
67 CREATE TABLE t2 (c VARCHAR(8), id int not null primary key, b int, key(b)) ENGINE=InnoDB ENCRYPTED=YES;
68 INSERT INTO t2 VALUES ('foobar',1,2);
69
70 --echo
71 --echo # Restart server with keys2.txt
72 -- let $restart_parameters=--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys2.txt
73 -- source include/restart_mysqld.inc
74
75 --disable_warnings
76 --error ER_TABLE_CORRUPT
77 SELECT * FROM t2;
78
79 --error ER_TABLE_CORRUPT
80 SELECT * FROM t2 where id = 1;
81
82 --error ER_TABLE_CORRUPT
83 SELECT * FROM t2 where b = 1;
84
85 --error ER_TABLE_CORRUPT
86 INSERT INTO t2 VALUES ('tmp',3,3);
87
88 --error ER_TABLE_CORRUPT
89 DELETE FROM t2 where b = 3;
90
91 --error ER_TABLE_CORRUPT
92 DELETE FROM t2 where id = 3;
93
94 --error ER_TABLE_CORRUPT
95 UPDATE t2 set b = b +1;
96
97 OPTIMIZE TABLE t2;
98
99 --error ER_TABLE_CORRUPT
100 ALTER TABLE t2 ADD COLUMN d INT;
101
102 ANALYZE TABLE t2;
103
104 --error ER_TABLE_CORRUPT
105 TRUNCATE TABLE t2;
106
107 DROP TABLE t2;
108 --enable_warnings
109
110 --echo
111 --echo # Start server with keys2.txt
112 -- let $restart_parameters=--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys2.txt
113 -- source include/restart_mysqld.inc