Debian Codegraph @

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

raw
1 #########################################################################
2 # START : WITHOUT KEYRING PLUGIN
3 #########################################################################
4
5 #########
6 # SETUP #
7 #########
8 CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' ENGINE=InnoDB ENCRYPTION="N";
9 CREATE TABLE t1(c1 char(100)) ENGINE=InnoDB TABLESPACE encrypt_ts;
10 set global innodb_buf_flush_list_now = 1;
11 SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts';
12 NAME ENCRYPTION
13 encrypt_ts N
14 SELECT * FROM t1 LIMIT 10;
15 c1
16 SOME VALUES
17 SOME VALUES
18 SOME VALUES
19 SOME VALUES
20 SOME VALUES
21 SOME VALUES
22 SOME VALUES
23 SOME VALUES
24 SOME VALUES
25 SOME VALUES
26 ALTER TABLESPACE encrypt_ts ENCRYPTION='Y';
27 ERROR HY000: Can't find master key from keyring, please check in the server log if a keyring is loaded and initialized successfully.
28 #############################################################
29 # TEST 1 : CRASH DURING ALTER ENCRYPT A TABLESPACE.
30 #############################################################
31
32 #########################################################################
33 # RESTART 1 : WITH KEYRING PLUGIN
34 #########################################################################
35 ############################################################
36 # ALTER TABLESPACE 1 : Unencrypted => Encrypted #
37 # (crash at page 10) #
38 ############################################################
39 # Set Encryption process to crash at page 10
40 SET SESSION debug= '+d,alter_encrypt_tablespace_page_10';
41 SET GLOBAL innodb_log_checkpoint_now = ON;
42 SET GLOBAL innodb_page_cleaner_disabled_debug = 1;
43 SET GLOBAL innodb_dict_stats_disabled_debug = 1;
44 SET GLOBAL innodb_master_thread_disabled_debug = 1;
45 # Encrypt the tablespace. It will cause crash.
46 ALTER TABLESPACE encrypt_ts ENCRYPTION='Y';
47 # Restart after crash without Keyring plugin loaded
48 Pattern "CORRUPT LOG RECORD FOUND" found
49 # Server shouldn't have restarted, so query should fail.
50 SELECT * from test.t1 limit 10;
51 ERROR HY000: Lost connection to MySQL server during query
52 #########################################################################
53 # RESTART 2 : WITH KEYRING PLUGIN
54 #########################################################################
55 # Server should have restarted properly.
56 SELECT * from test.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 # Bug#30888919 : [INNODB] ASSERTION FAILURE:SPACE->ENCRYPTION_OP_IN_PROGRESS == NONE
70 #
71 ALTER TABLESPACE encrypt_ts ENCRYPTION='N';
72 SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts';
73 NAME ENCRYPTION
74 encrypt_ts N
75 SELECT * FROM t1 LIMIT 10;
76 c1
77 SOME VALUES
78 SOME VALUES
79 SOME VALUES
80 SOME VALUES
81 SOME VALUES
82 SOME VALUES
83 SOME VALUES
84 SOME VALUES
85 SOME VALUES
86 SOME VALUES
87 ############################################################
88 # ALTER TABLESPACE : Unencrypted => Encrypted #
89 # (crash at page 10) #
90 ############################################################
91 # Connection con1:
92 # Set Encryption process to crash at page 10
93 SET SESSION debug= '+d,alter_encrypt_tablespace_page_10';
94 # Encrypt the tablespace. It will cause crash.
95 ALTER TABLESPACE encrypt_ts ENCRYPTION='Y';
96 # Restart after crash with sleep_resume_alter_encrypt to make resume
97 # thread to sleep.
98 # Connection con2:
99 # Check that this connection id is same as of the one which was trying
100 # to encrypt the tablespace before crash.
101 Connectin ids are same.
102 CREATE TABLESPACE temp_ts ADD DATAFILE 'temp_ts.ibd';
103 # connection con3
104 SELECT connection_id();
105 connection_id()
106 10
107 # Run a DDL with this connection con3
108 ALTER TABLESPACE temp_ts ENCRYPTION='Y';
109 set global innodb_buf_flush_list_now = 1;
110 # Now restart without sleep_resume_alter_encrypt.
111 # Kill and restart: --early-plugin-load=keyring_file=keyring_file.so --loose-keyring_file_data=MYSQL_TMP_DIR/mysecret_keyring --plugin-dir=KEYRING_PLUGIN_PATH
112 # Wait for Encryption processing to finish in background thread
113 # After restart/recovery, check that Encryption was roll-forward
114 SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts';
115 NAME ENCRYPTION
116 encrypt_ts Y
117 SELECT * FROM t1 LIMIT 10;
118 c1
119 SOME VALUES
120 SOME VALUES
121 SOME VALUES
122 SOME VALUES
123 SOME VALUES
124 SOME VALUES
125 SOME VALUES
126 SOME VALUES
127 SOME VALUES
128 SOME VALUES
129 # Now try to encrypt tablespace. Without patch, an assert will be hit.
130 ALTER TABLESPACE encrypt_ts ENCRYPTION='Y';
131 ###########
132 # Cleanup #
133 ###########
134 DROP TABLE t1;
135 DROP TABLESPACE encrypt_ts;
136 # Restarting server without keyring to restore server state
137 # restart: