Debian Codegraph @

mysql-test/suite/component_keyring_file/r/tablespace_encrypt_7.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 #########################################################################
8 # START : WITHOUT KEYRING PLUGIN
9 #########################################################################
10 # Taking backup of local manifest file for MySQL server instance
11 #########
12 # SETUP #
13 #########
14 CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' ENGINE=InnoDB ENCRYPTION="N";
15 CREATE TABLE t1(c1 char(100)) ENGINE=InnoDB TABLESPACE encrypt_ts;
16 set global innodb_buf_flush_list_now = 1;
17 SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts';
18 NAME ENCRYPTION
19 encrypt_ts N
20 SELECT * FROM t1 LIMIT 10;
21 c1
22 SOME VALUES
23 SOME VALUES
24 SOME VALUES
25 SOME VALUES
26 SOME VALUES
27 SOME VALUES
28 SOME VALUES
29 SOME VALUES
30 SOME VALUES
31 SOME VALUES
32 ALTER TABLESPACE encrypt_ts ENCRYPTION='Y';
33 ERROR HY000: Can't find master key from keyring, please check in the server log if a keyring is loaded and initialized successfully.
34 #-------------------------- TEST 0 -------------------------------------#
35 #########################################################################
36 # RESTART 1 : WITH KEYRING PLUGIN
37 #########################################################################
38 # Restore local manifest file for MySQL server instance from backup
39 ########################################################################
40 # ALTER TABLESPACE 1 : Unencrypted => Encrypted #
41 # crash just before flushing page 0 at the end #
42 ########################################################################
43 # Set process to crash just before flushing page 0 at the end
44 SET SESSION debug= '+d,alter_encrypt_tablespace_crash_after_ddl_entry';
45 # Encrypt the tablespace. It will cause crash.
46 ALTER TABLESPACE encrypt_ts ENCRYPTION='Y';
47 #########################################################################
48 # RESTART 2 : WITH KEYRING PLUGIN after crash
49 #########################################################################
50 # Wait for Encryption processing to finish in background thread
51 set global innodb_buf_flush_list_now = 1;
52 # After restart/recovery, check that Encryption was roll-forward
53 SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts';
54 NAME ENCRYPTION
55 encrypt_ts Y
56 SELECT * FROM t1 LIMIT 10;
57 c1
58 SOME VALUES
59 SOME VALUES
60 SOME VALUES
61 SOME VALUES
62 SOME VALUES
63 SOME VALUES
64 SOME VALUES
65 SOME VALUES
66 SOME VALUES
67 SOME VALUES
68 #########################################################################
69 # RESTART 3 : WITHOUT KEYRING PLUGIN
70 #########################################################################
71 # Taking backup of local manifest file for MySQL server instance
72 SELECT * FROM t1 LIMIT 10;
73 ERROR HY000: Can't find master key from keyring, please check in the server log if a keyring is loaded and initialized successfully.
74 #########################################################################
75 # RESTART 4 : WITH KEYRING PLUGIN
76 #########################################################################
77 # Restore local manifest file for MySQL server instance from backup
78 SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts';
79 NAME ENCRYPTION
80 encrypt_ts Y
81 SELECT * FROM t1 LIMIT 10;
82 c1
83 SOME VALUES
84 SOME VALUES
85 SOME VALUES
86 SOME VALUES
87 SOME VALUES
88 SOME VALUES
89 SOME VALUES
90 SOME VALUES
91 SOME VALUES
92 SOME VALUES
93 ########################################################################
94 # ALTER TABLESPACE 2 : Encrypted => Unencrypted #
95 # crash just before flushing page 0 at the end #
96 ########################################################################
97 # Set process to crash just before flushing page 0 at the end
98 SET SESSION debug= '+d,alter_encrypt_tablespace_crash_after_ddl_entry';
99 # Unencrypt the tablespace. It will cause crash.
100 ALTER TABLESPACE encrypt_ts ENCRYPTION='N';
101 #########################################################################
102 # RESTART 5 : WITH KEYRING PLUGIN after crash
103 #########################################################################
104 # Wait for Unencryption processing to finish in background thread
105 set global innodb_buf_flush_list_now = 1;
106 # After restart/recovery, check that Unencryption was roll-forward
107 SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts';
108 NAME ENCRYPTION
109 encrypt_ts N
110 SELECT * FROM t1 LIMIT 10;
111 c1
112 SOME VALUES
113 SOME VALUES
114 SOME VALUES
115 SOME VALUES
116 SOME VALUES
117 SOME VALUES
118 SOME VALUES
119 SOME VALUES
120 SOME VALUES
121 SOME VALUES
122 #########################################################################
123 # RESTART 6 : WITHOUT KEYRING PLUGIN
124 #########################################################################
125 # Taking backup of local manifest file for MySQL server instance
126 SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts';
127 NAME ENCRYPTION
128 encrypt_ts N
129 SELECT * FROM t1 LIMIT 10;
130 c1
131 SOME VALUES
132 SOME VALUES
133 SOME VALUES
134 SOME VALUES
135 SOME VALUES
136 SOME VALUES
137 SOME VALUES
138 SOME VALUES
139 SOME VALUES
140 SOME VALUES
141 #-------------------------- TEST 1 -------------------------------------#
142 #########################################################################
143 # RESTART 7 : WITH KEYRING PLUGIN
144 #########################################################################
145 # Restore local manifest file for MySQL server instance from backup
146 ########################################################################
147 # ALTER TABLESPACE 1 : Unencrypted => Encrypted #
148 # crash just before flushing page 0 at the end #
149 ########################################################################
150 # Set process to crash just before flushing page 0 at the end
151 SET SESSION debug= '+d,alter_encrypt_tablespace_crash_before_flushing_page_0';
152 # Encrypt the tablespace. It will cause crash.
153 ALTER TABLESPACE encrypt_ts ENCRYPTION='Y';
154 #########################################################################
155 # RESTART 8 : WITH KEYRING PLUGIN after crash
156 #########################################################################
157 # Wait for Encryption processing to finish in background thread
158 set global innodb_buf_flush_list_now = 1;
159 # After restart/recovery, check that Encryption was roll-forward
160 SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts';
161 NAME ENCRYPTION
162 encrypt_ts Y
163 SELECT * FROM t1 LIMIT 10;
164 c1
165 SOME VALUES
166 SOME VALUES
167 SOME VALUES
168 SOME VALUES
169 SOME VALUES
170 SOME VALUES
171 SOME VALUES
172 SOME VALUES
173 SOME VALUES
174 SOME VALUES
175 #########################################################################
176 # RESTART 9 : WITHOUT KEYRING PLUGIN
177 #########################################################################
178 # Taking backup of local manifest file for MySQL server instance
179 SELECT * FROM t1 LIMIT 10;
180 ERROR HY000: Can't find master key from keyring, please check in the server log if a keyring is loaded and initialized successfully.
181 #########################################################################
182 # RESTART 10 : WITH KEYRING PLUGIN
183 #########################################################################
184 # Restore local manifest file for MySQL server instance from backup
185 SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts';
186 NAME ENCRYPTION
187 encrypt_ts Y
188 SELECT * FROM t1 LIMIT 10;
189 c1
190 SOME VALUES
191 SOME VALUES
192 SOME VALUES
193 SOME VALUES
194 SOME VALUES
195 SOME VALUES
196 SOME VALUES
197 SOME VALUES
198 SOME VALUES
199 SOME VALUES
200 ########################################################################
201 # ALTER TABLESPACE 2 : Encrypted => Unencrypted #
202 # crash just before flushing page 0 at the end #
203 ########################################################################
204 # Set process to crash just before flushing page 0 at the end
205 SET SESSION debug= '+d,alter_encrypt_tablespace_crash_before_flushing_page_0';
206 # Unencrypt the tablespace. It will cause crash.
207 ALTER TABLESPACE encrypt_ts ENCRYPTION='N';
208 #########################################################################
209 # RESTART 11 : WITH KEYRING PLUGIN after crash
210 #########################################################################
211 # Wait for Unencryption processing to finish in background thread
212 set global innodb_buf_flush_list_now = 1;
213 # After restart/recovery, check that Unencryption was roll-forward
214 SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts';
215 NAME ENCRYPTION
216 encrypt_ts N
217 SELECT * FROM t1 LIMIT 10;
218 c1
219 SOME VALUES
220 SOME VALUES
221 SOME VALUES
222 SOME VALUES
223 SOME VALUES
224 SOME VALUES
225 SOME VALUES
226 SOME VALUES
227 SOME VALUES
228 SOME VALUES
229 #########################################################################
230 # RESTART 12 : WITHOUT KEYRING PLUGIN
231 #########################################################################
232 # Taking backup of local manifest file for MySQL server instance
233 SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts';
234 NAME ENCRYPTION
235 encrypt_ts N
236 SELECT * FROM t1 LIMIT 10;
237 c1
238 SOME VALUES
239 SOME VALUES
240 SOME VALUES
241 SOME VALUES
242 SOME VALUES
243 SOME VALUES
244 SOME VALUES
245 SOME VALUES
246 SOME VALUES
247 SOME VALUES
248 #########################################################################
249 # RESTART 13 : WITH KEYRING PLUGIN
250 #########################################################################
251 # Restore local manifest file for MySQL server instance from backup
252 ########################################################################
253 # ALTER TABLESPACE 3 : Unencrypted => Encrypted #
254 # crash just after flushing page 0 at the end #
255 ########################################################################
256 # Set process to crash just after flushing page 0 at the end
257 SET SESSION debug= '+d,alter_encrypt_tablespace_crash_after_flushing_page_0';
258 # Encrypt the tablespace. It will cause crash.
259 ALTER TABLESPACE encrypt_ts ENCRYPTION='Y';
260 #########################################################################
261 # RESTART 14 : WITH KEYRING PLUGIN after crash
262 #########################################################################
263 # Wait for Encryption processing to finish in background thread
264 set global innodb_buf_flush_list_now = 1;
265 # After restart/recovery, check that Encryption was roll-forward
266 SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts';
267 NAME ENCRYPTION
268 encrypt_ts Y
269 SELECT * FROM t1 LIMIT 10;
270 c1
271 SOME VALUES
272 SOME VALUES
273 SOME VALUES
274 SOME VALUES
275 SOME VALUES
276 SOME VALUES
277 SOME VALUES
278 SOME VALUES
279 SOME VALUES
280 SOME VALUES
281 #########################################################################
282 # RESTART 15 : WITHOUT KEYRING PLUGIN
283 #########################################################################
284 # Taking backup of local manifest file for MySQL server instance
285 SELECT * FROM t1 LIMIT 10;
286 ERROR HY000: Can't find master key from keyring, please check in the server log if a keyring is loaded and initialized successfully.
287 #########################################################################
288 # RESTART 16 : WITH KEYRING PLUGIN
289 #########################################################################
290 # Restore local manifest file for MySQL server instance from backup
291 SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts';
292 NAME ENCRYPTION
293 encrypt_ts Y
294 SELECT * FROM t1 LIMIT 10;
295 c1
296 SOME VALUES
297 SOME VALUES
298 SOME VALUES
299 SOME VALUES
300 SOME VALUES
301 SOME VALUES
302 SOME VALUES
303 SOME VALUES
304 SOME VALUES
305 SOME VALUES
306 ########################################################################
307 # ALTER TABLESPACE 4 : Encrypted => Unencrypted #
308 # crash just after flushing page 0 at the end #
309 ########################################################################
310 # Set process to crash just after flushing page 0 at the end
311 SET SESSION debug= '+d,alter_encrypt_tablespace_crash_after_flushing_page_0';
312 # Unencrypt the tablespace. It will cause crash.
313 ALTER TABLESPACE encrypt_ts ENCRYPTION='N';
314 #########################################################################
315 # RESTART 17 : WITH KEYRING PLUGIN after crash
316 #########################################################################
317 # Wait for Unencryption processing to finish in background thread
318 set global innodb_buf_flush_list_now = 1;
319 # After restart/recovery, check that Unencryption was roll-forward
320 SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts';
321 NAME ENCRYPTION
322 encrypt_ts N
323 SELECT * FROM t1 LIMIT 10;
324 c1
325 SOME VALUES
326 SOME VALUES
327 SOME VALUES
328 SOME VALUES
329 SOME VALUES
330 SOME VALUES
331 SOME VALUES
332 SOME VALUES
333 SOME VALUES
334 SOME VALUES
335 #########################################################################
336 # RESTART 18 : WITHOUT KEYRING PLUGIN
337 #########################################################################
338 # Taking backup of local manifest file for MySQL server instance
339 SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts';
340 NAME ENCRYPTION
341 encrypt_ts N
342 SELECT * FROM t1 LIMIT 10;
343 c1
344 SOME VALUES
345 SOME VALUES
346 SOME VALUES
347 SOME VALUES
348 SOME VALUES
349 SOME VALUES
350 SOME VALUES
351 SOME VALUES
352 SOME VALUES
353 SOME VALUES
354 #-------------------------- TEST 2 -------------------------------------#
355 #########################################################################
356 # RESTART 19 : WITH KEYRING PLUGIN
357 #########################################################################
358 # Restore local manifest file for MySQL server instance from backup
359 SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts';
360 NAME ENCRYPTION
361 encrypt_ts N
362 SELECT * FROM t1 LIMIT 10;
363 c1
364 SOME VALUES
365 SOME VALUES
366 SOME VALUES
367 SOME VALUES
368 SOME VALUES
369 SOME VALUES
370 SOME VALUES
371 SOME VALUES
372 SOME VALUES
373 SOME VALUES
374 ########################################################################
375 # ALTER TABLESPACE 5 : Encrypted => unencrypted #
376 # crash just before updating ts flags on page0 #
377 ########################################################################
378 ALTER TABLESPACE encrypt_ts ENCRYPTION='Y';
379 # Set process to crash just after flushing page 0 at the end
380 SET SESSION debug= '+d,alter_encrypt_tablespace_crash_before_updating_flags';
381 # Unencrypt the tablespace. It will cause crash.
382 ALTER TABLESPACE encrypt_ts ENCRYPTION='N';
383 #########################################################################
384 # RESTART 20 : WITH KEYRING PLUGIN after crash
385 #########################################################################
386 # Wait for Unencryption processing to finish in background thread
387 set global innodb_buf_flush_list_now = 1;
388 # After restart/recovery, check that Unencryption was roll-forward
389 SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts';
390 NAME ENCRYPTION
391 encrypt_ts N
392 SELECT * FROM t1 LIMIT 10;
393 c1
394 SOME VALUES
395 SOME VALUES
396 SOME VALUES
397 SOME VALUES
398 SOME VALUES
399 SOME VALUES
400 SOME VALUES
401 SOME VALUES
402 SOME VALUES
403 SOME VALUES
404 #########################################################################
405 # RESTART 21 : WITHOUT KEYRING PLUGIN
406 #########################################################################
407 # Taking backup of local manifest file for MySQL server instance
408 SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts';
409 NAME ENCRYPTION
410 encrypt_ts N
411 SELECT * FROM t1 LIMIT 10;
412 c1
413 SOME VALUES
414 SOME VALUES
415 SOME VALUES
416 SOME VALUES
417 SOME VALUES
418 SOME VALUES
419 SOME VALUES
420 SOME VALUES
421 SOME VALUES
422 SOME VALUES
423 #########################################################################
424 # RESTART 22 : WITH KEYRING PLUGIN
425 #########################################################################
426 # Restore local manifest file for MySQL server instance from backup
427 SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts';
428 NAME ENCRYPTION
429 encrypt_ts N
430 SELECT * FROM t1 LIMIT 10;
431 c1
432 SOME VALUES
433 SOME VALUES
434 SOME VALUES
435 SOME VALUES
436 SOME VALUES
437 SOME VALUES
438 SOME VALUES
439 SOME VALUES
440 SOME VALUES
441 SOME VALUES
442 ########################################################################
443 # ALTER TABLESPACE 6 : Encrypted => unencrypted #
444 # crash just before resetting progress onpage 0 #
445 ########################################################################
446 ALTER TABLESPACE encrypt_ts ENCRYPTION='Y';
447 # Set process to crash just after flushing page 0 at the end
448 SET SESSION debug= '+d,alter_encrypt_tablespace_crash_before_resetting_progress';
449 # Unencrypt the tablespace. It will cause crash.
450 ALTER TABLESPACE encrypt_ts ENCRYPTION='N';
451 #########################################################################
452 # RESTART 23 : WITH KEYRING PLUGIN after crash
453 #########################################################################
454 # Wait for Unencryption processing to finish in background thread
455 set global innodb_buf_flush_list_now = 1;
456 # After restart/recovery, check that Unencryption was roll-forward
457 SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts';
458 NAME ENCRYPTION
459 encrypt_ts N
460 SELECT * FROM t1 LIMIT 10;
461 c1
462 SOME VALUES
463 SOME VALUES
464 SOME VALUES
465 SOME VALUES
466 SOME VALUES
467 SOME VALUES
468 SOME VALUES
469 SOME VALUES
470 SOME VALUES
471 SOME VALUES
472 #########################################################################
473 # RESTART 24: WITHOUT KEYRING PLUGIN
474 #########################################################################
475 # Taking backup of local manifest file for MySQL server instance
476 SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts';
477 NAME ENCRYPTION
478 encrypt_ts N
479 SELECT * FROM t1 LIMIT 10;
480 c1
481 SOME VALUES
482 SOME VALUES
483 SOME VALUES
484 SOME VALUES
485 SOME VALUES
486 SOME VALUES
487 SOME VALUES
488 SOME VALUES
489 SOME VALUES
490 SOME VALUES
491 #-------------------------- TEST 3 -------------------------------------#
492 #########################################################################
493 # RESTART 25 : WITH KEYRING PLUGIN
494 #########################################################################
495 # Restore local manifest file for MySQL server instance from backup
496 DROP TABLE t1;
497 DROP TABLESPACE encrypt_ts;
498 CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd';
499 CREATE TABLE t1 (C CHAR(10)) TABLESPACE=encrypt_ts;
500 SET GLOBAL innodb_limit_optimistic_insert_debug=2;
501 INSERT INTO t1 VALUES("SOMEVALUE");
502 INSERT INTO t1 VALUES("SOMEVALUE");
503 INSERT INTO t1 VALUES("SOMEVALUE");
504 INSERT INTO t1 VALUES("SOMEVALUE");
505 INSERT INTO t1 VALUES("SOMEVALUE");
506 INSERT INTO t1 VALUES("SOMEVALUE");
507 INSERT INTO t1 VALUES("SOMEVALUE");
508 # Make sure checkpoint is not moved
509 SET GLOBAL innodb_log_checkpoint_now = ON;
510 SET GLOBAL innodb_page_cleaner_disabled_debug = 1;
511 SET GLOBAL innodb_dict_stats_disabled_debug = 1;
512 SET GLOBAL innodb_master_thread_disabled_debug = 1;
513 # Following encryption will create a new tablespace key (KEY1)
514 # KEY1 will be written on REDO log
515 ALTER TABLESPACE encrypt_ts encryption='Y';
516 # Following unencryption will remove tablespace key
517 ALTER TABLESPACE encrypt_ts encryption='N';
518 SET SESSION debug= '+d,alter_encrypt_tablespace_page_6';
519 SET SESSION debug= '+d,flush_each_dirtied_page';
520 # Following encryption will create a new tablespace key (KEY2)
521 # KEY2 will be written on REDO log
522 # Flush dirtied pages encrypted with KEY2 before crash
523 ALTER TABLESPACE encrypt_ts encryption='Y';
524 #########################################################################
525 # RESTART 26: WITH KEYRING PLUGIN after crash
526 #########################################################################
527 ###########
528 # Cleanup #
529 ###########
530 DROP TABLE t1;
531 DROP TABLESPACE encrypt_ts;
532 # ----------------------------------------------------------------------
533 # Teardown
534 # Removing manifest file for current MySQL server instance
535 # Removing local keyring file for keyring component: component_keyring_file
536 # Removing local configuration file for keyring component: component_keyring_file
537 # Restarting server without the manifest file
538 # ----------------------------------------------------------------------