Debian Codegraph @

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

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