Debian Codegraph @

mysql-test/suite/innodb/r/table_encrypt_debug.result

raw
1 SET GLOBAL innodb_file_per_table = 1;
2 SELECT @@innodb_file_per_table;
3 @@innodb_file_per_table
4 1
5 DROP DATABASE IF EXISTS tde_db;
6 CREATE DATABASE tde_db;
7 USE tde_db;
8 #
9 # Set encryption ON for table `mysql`
10 #
11 ALTER TABLESPACE mysql ENCRYPTION='Y';
12 SET debug='+d,skip_dd_table_access_check';
13 SELECT NAME,OPTIONS FROM mysql.tablespaces WHERE OPTIONS LIKE '%encryption=Y%';
14 NAME OPTIONS
15 mysql encryption=Y;
16 SET debug='-d,skip_dd_table_access_check';
17 #
18 # Test crash point `ib_crash_during_rotation_for_encryption`
19 #
20 SET SESSION DEBUG="+d,ib_encryption_rotate_crash";
21 CREATE TABLE tde_db.t1(c1 INT, c2 char(20)) ENCRYPTION="Y" ENGINE = InnoDB;
22 SET debug='+d,skip_dd_table_access_check';
23 SELECT NAME,OPTIONS FROM mysql.tablespaces WHERE OPTIONS LIKE '%encryption=Y%';
24 NAME OPTIONS
25 mysql encryption=Y;
26 tde_db/t1 autoextend_size=0;encryption=Y;
27 SET debug='-d,skip_dd_table_access_check';
28 SHOW CREATE TABLE tde_db.t1;
29 Table Create Table
30 t1 CREATE TABLE `t1` (
31 `c1` int DEFAULT NULL,
32 `c2` char(20) DEFAULT NULL
33 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='Y'
34 INSERT INTO tde_db.t1 VALUES(0, "aaaaa");
35 INSERT INTO tde_db.t1 VALUES(1, "bbbbb");
36 INSERT INTO tde_db.t1 VALUES(2, "ccccc");
37 INSERT INTO tde_db.t1 VALUES(3, "ddddd");
38 # Execute the statement that causes the crash
39 ALTER INSTANCE ROTATE INNODB MASTER KEY;
40 ERROR HY000: Lost connection to MySQL server during query
41 SET SESSION DEBUG="-d,ib_encryption_rotate_crash";
42 Pattern "ib_encryption_rotate_crash" found
43 # Show that encryption is OK
44 SET debug='+d,skip_dd_table_access_check';
45 SELECT NAME,OPTIONS FROM mysql.tablespaces WHERE OPTIONS LIKE '%encryption=Y%';
46 NAME OPTIONS
47 mysql encryption=Y;
48 tde_db/t1 autoextend_size=0;encryption=Y;
49 SET debug='-d,skip_dd_table_access_check';
50 INSERT INTO tde_db.t1 VALUES(4, "eeeee");
51 SELECT * FROM tde_db.t1 ORDER BY c1;
52 c1 c2
53 0 aaaaa
54 1 bbbbb
55 2 ccccc
56 3 ddddd
57 4 eeeee
58 # Create a second table with encryption
59 CREATE TABLE tde_db.t2(c1 INT, c2 char(20)) ENCRYPTION="Y" ENGINE = InnoDB;
60 SHOW CREATE TABLE tde_db.t2;
61 Table Create Table
62 t2 CREATE TABLE `t2` (
63 `c1` int DEFAULT NULL,
64 `c2` char(20) DEFAULT NULL
65 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='Y'
66 SET debug='+d,skip_dd_table_access_check';
67 SELECT NAME,OPTIONS FROM mysql.tablespaces WHERE OPTIONS LIKE '%encryption=Y%';
68 NAME OPTIONS
69 mysql encryption=Y;
70 tde_db/t1 autoextend_size=0;encryption=Y;
71 tde_db/t2 autoextend_size=0;encryption=Y;
72 SET debug='-d,skip_dd_table_access_check';
73 INSERT INTO tde_db.t2 VALUES(0, "aaaaa");
74 INSERT INTO tde_db.t2 VALUES(1, "bbbbb");
75 # Remove the current auto.cnf file to make sure a new server uuid is
76 # generated at restart.
77 # Execute the statement that causes the crash
78 SET SESSION DEBUG="+d,ib_encryption_rotate_crash";
79 ALTER INSTANCE ROTATE INNODB MASTER KEY;
80 ERROR HY000: Lost connection to MySQL server during query
81 SET SESSION DEBUG="-d,ib_encryption_rotate_crash";
82 Pattern "ib_encryption_rotate_crash" found
83 # Show that encryption is OK
84 SET debug='+d,skip_dd_table_access_check';
85 SELECT NAME,OPTIONS FROM mysql.tablespaces WHERE OPTIONS LIKE '%encryption=Y%';
86 NAME OPTIONS
87 mysql encryption=Y;
88 tde_db/t1 autoextend_size=0;encryption=Y;
89 tde_db/t2 autoextend_size=0;encryption=Y;
90 SET debug='-d,skip_dd_table_access_check';
91 INSERT INTO tde_db.t1 VALUES(5, "fffff");
92 SELECT * FROM tde_db.t1 ORDER BY c1;
93 c1 c2
94 0 aaaaa
95 1 bbbbb
96 2 ccccc
97 3 ddddd
98 4 eeeee
99 5 fffff
100 SELECT * FROM tde_db.t2 ORDER BY c1;
101 c1 c2
102 0 aaaaa
103 1 bbbbb
104 # Rotate Encryption again without the Crash
105 ALTER INSTANCE ROTATE INNODB MASTER KEY;
106 SELECT * FROM tde_db.t1 ORDER BY c1 ;
107 c1 c2
108 0 aaaaa
109 1 bbbbb
110 2 ccccc
111 3 ddddd
112 4 eeeee
113 5 fffff
114 # Show that encryption is OK
115 SET debug='+d,skip_dd_table_access_check';
116 SELECT NAME,OPTIONS FROM mysql.tablespaces WHERE OPTIONS LIKE '%encryption=Y%';
117 NAME OPTIONS
118 mysql encryption=Y;
119 tde_db/t1 autoextend_size=0;encryption=Y;
120 tde_db/t2 autoextend_size=0;encryption=Y;
121 SET debug='-d,skip_dd_table_access_check';
122 SELECT * FROM tde_db.t1 ORDER BY c1 ;
123 c1 c2
124 0 aaaaa
125 1 bbbbb
126 2 ccccc
127 3 ddddd
128 4 eeeee
129 5 fffff
130 SELECT * FROM tde_db.t2 ORDER BY c1 ;
131 c1 c2
132 0 aaaaa
133 1 bbbbb
134 DROP TABLE tde_db.t2;
135 ALTER TABLESPACE mysql ENCRYPTION='N';
136 SET debug='+d,skip_dd_table_access_check';
137 SELECT NAME,OPTIONS FROM mysql.tablespaces WHERE OPTIONS LIKE '%encryption=Y%';
138 NAME OPTIONS
139 tde_db/t1 autoextend_size=0;encryption=Y;
140 SET debug='-d,skip_dd_table_access_check';
141 #
142 # Test crash point `ib_crash_during_create_for_encryption` during a CREATE TABLE
143 #
144 SET SESSION DEBUG="+d,ib_crash_during_create_for_encryption";
145 # Execute the statement that causes the crash
146 CREATE TABLE tde_db.t2(c1 INT, c2 char(20)) ENCRYPTION="Y" ENGINE = InnoDB;
147 ERROR HY000: Lost connection to MySQL server during query
148 SET SESSION DEBUG="-d,ib_crash_during_create_for_encryption";
149 # Show encrypted tables.
150 SET debug='+d,skip_dd_table_access_check';
151 SELECT NAME,OPTIONS FROM mysql.tablespaces WHERE OPTIONS LIKE '%encryption=Y%';
152 NAME OPTIONS
153 tde_db/t1 autoextend_size=0;encryption=Y;
154 SET debug='-d,skip_dd_table_access_check';
155 SELECT * FROM tde_db.t1 ORDER BY c1 LIMIT 5;
156 c1 c2
157 0 aaaaa
158 1 bbbbb
159 2 ccccc
160 3 ddddd
161 4 eeeee
162 INSERT INTO tde_db.t1 VALUES(6, "ggggg");
163 SELECT * FROM tde_db.t1 ORDER BY c1 ;
164 c1 c2
165 0 aaaaa
166 1 bbbbb
167 2 ccccc
168 3 ddddd
169 4 eeeee
170 5 fffff
171 6 ggggg
172 SELECT * FROM tde_db.t2;
173 ERROR 42S02: Table 'tde_db.t2' doesn't exist
174 #
175 # Test crash point `ib_crash_during_decrypt_page` during an IMPORT TABLESPACE
176 #
177 FLUSH TABLE tde_db.t1 FOR EXPORT;
178 UNLOCK TABLES;
179 ALTER TABLE tde_db.t1 DISCARD TABLESPACE;
180 SET SESSION DEBUG="+d,ib_crash_during_decrypt_page";
181 # Execute the statement that causes the crash
182 ALTER TABLE tde_db.t1 IMPORT TABLESPACE;
183 ERROR HY000: Lost connection to MySQL server during query
184 SET SESSION DEBUG="-d,ib_crash_during_decrypt_page";
185 INSERT INTO tde_db.t1 VALUES(7, "hhhhh");
186 ERROR HY000: Tablespace has been discarded for table 't1'
187 SELECT * FROM tde_db.t1 ORDER BY c1 ;
188 ERROR HY000: Tablespace has been discarded for table 't1'
189 DROP TABLE tde_db.t1;
190 DROP DATABASE tde_db;
191 #
192 # Bug #27307740 [ERROR] [MY-011066] INNODB: CORRUPT LOG RECORD FOUND
193 # DURING CRASH RECOVERY
194 #
195 CREATE DATABASE tde_db;
196 CREATE TABLE tde_db.test_tbl(c1 int) ENCRYPTION="Y" ENGINE=InnoDB;
197 SET SESSION DEBUG="+d,keyring_file_backup_fail";
198 ALTER INSTANCE ROTATE INNODB MASTER KEY;
199 ERROR HY000: Lost connection to MySQL server during query
200 SET SESSION DEBUG="-d,keyring_file_backup_fail";
201 SELECT COUNT(*) FROM tde_db.test_tbl;
202 COUNT(*)
203 0
204 DROP TABLE tde_db.test_tbl;
205 DROP DATABASE tde_db;
206 SET GLOBAL innodb_file_per_table=1;
207 # restart
208 CREATE TABLE test.t1(c1 INT, c2 char(20)) ENCRYPTION="Y" ENGINE = InnoDB;
209 DROP TABLE test.t1;