Debian Codegraph @

mysql-test/suite/innodb/t/tablespace_encrypt_11.test

raw
1 ################################################################################
2 # InnoDB transparent tablespace data encryption for general shared tablespace.
3 # This test case will test recovery abort on 2 error injection
4 ################################################################################
5
6 --source include/big_test.inc
7 --source include/have_debug.inc
8 # --source include/no_valgrind_without_big.inc
9 # Disable in valgrind because of timeout, cf. Bug#22760145
10 --source include/not_valgrind.inc
11 # Waiting time when (re)starting the server
12 --let $explicit_default_wait_counter=10000
13
14 --disable_query_log
15 call mtr.add_suppression("\\[ERROR\\] \\[[^]]*\\] \\[[^]]*\\] Check keyring plugin fail, please check the keyring plugin is loaded.");
16 call mtr.add_suppression("\\[ERROR\\] \\[[^]]*\\] \\[[^]]*\\] Failed to decrypt encryption information, found unexpected version of it!");
17 call mtr.add_suppression("\\[Warning\\] \\[MY-013674\\] \\[Innodb\\] Decrypting a page in doublewrite file failed");
18 call mtr.add_suppression("\\[Warning\\] \\[MY-013675\\] \\[Innodb\\] Encryption key missing");
19 --enable_query_log
20
21 --write_file $MYSQLTEST_VARDIR/tmp/setup.inc EXECUTE_STEP
22 # Create an Unencrypted tablespace
23 CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' ENGINE=InnoDB ENCRYPTION="N";
24 # Create an unencrypted table in tablespace
25 CREATE TABLE t1(c1 char(100)) ENGINE=InnoDB TABLESPACE encrypt_ts;
26 # Insert few rows in table
27 --disable_query_log
28 INSERT INTO t1 VALUES ("SOME VALUES");
29 let $counter=12;
30 while ($counter>0)
31 {
32 INSERT INTO test.t1 SELECT * FROM test.t1;
33 dec $counter;
34 }
35 --enable_query_log
36
37 # Make sure ts file is updated with new records in table
38 set global innodb_buf_flush_list_now = 1;
39
40 SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts';
41 SELECT * FROM t1 LIMIT 10;
42 EXECUTE_STEP
43
44 --echo #########
45 --echo # SETUP #
46 --echo #########
47
48 --let $rc=1
49
50 --echo #########################################################################
51 --echo # RESTART $rc : WITH KEYRING PLUGIN
52 --echo #########################################################################
53 let $restart_parameters = restart: --early-plugin-load=keyring_file=$KEYRING_PLUGIN --loose-keyring_file_data=$MYSQL_TMP_DIR/mysecret_keyring $KEYRING_PLUGIN_OPT;
54 --source include/restart_mysqld_no_echo.inc
55 --inc $rc
56
57 --echo #-------------------------- TEST 1 -------------------------------------#
58 --let $location=DDL_Log_remove_inject_startup_error_1
59 --let SEARCH_PATTERN=ENCRYPTION for tablespace encrypt_ts:[0-9]+ could not be done successfully
60 --source $MYSQLTEST_VARDIR/tmp/setup.inc
61
62 --echo # Set Encryption process to crash just after making DDL Entry
63 SET SESSION debug= '+d,alter_encrypt_tablespace_crash_after_ddl_entry';
64
65 --echo # Encrypt the tablespace. It will cause crash.
66 --source include/expect_crash.inc
67 --error 0,CR_SERVER_LOST,ER_INTERNAL_ERROR
68 ALTER TABLESPACE encrypt_ts ENCRYPTION='Y';
69
70 --echo #########################################################################
71 --echo # RESTART $rc : WITH KEYRING PLUGIN after crash
72 --echo #########################################################################
73
74 --echo # INJECT error TOO_MANY_CONCURRENT_TXNS in startup location $location.
75 --echo # It will cause FATAL error and server abort.
76 let $restart_parameters = restart: --early-plugin-load=keyring_file=$KEYRING_PLUGIN --loose-keyring_file_data=$MYSQL_TMP_DIR/mysecret_keyring $KEYRING_PLUGIN_OPT --log-error=$MYSQLTEST_VARDIR/log/my_restart.err --debug=+d,$location;
77 --source include/start_mysqld_no_echo.inc
78 --inc $rc
79
80 --echo # Search the failure pattern in error log
81 --let SEARCH_FILE= $MYSQLTEST_VARDIR/log/my_restart.err
82 --source include/search_pattern.inc
83
84 DROP TABLE t1;
85 DROP TABLESPACE encrypt_ts;
86
87 --echo #########################################################################
88 --echo # RESTART $rc : normally
89 --echo #########################################################################
90 let $restart_parameters = restart: --early-plugin-load=keyring_file=$KEYRING_PLUGIN --loose-keyring_file_data=$MYSQL_TMP_DIR/mysecret_keyring $KEYRING_PLUGIN_OPT;
91 --source include/restart_mysqld_no_echo.inc
92 --remove_file $MYSQLTEST_VARDIR/log/my_restart.err
93 --inc $rc
94
95 --echo #-------------------------- TEST 2 -------------------------------------#
96 --let $location=DDL_Log_remove_inject_startup_error_2
97 --let SEARCH_PATTERN=\[FATAL\] Error in DDL Log recovery during Post-Recovery processing.
98 --source $MYSQLTEST_VARDIR/tmp/setup.inc
99
100 --echo # Set Encryption process to crash just after making DDL Entry
101 SET SESSION debug= '+d,alter_encrypt_tablespace_crash_after_ddl_entry';
102
103 --echo # Encrypt the tablespace. It will cause crash.
104 --source include/expect_crash.inc
105 --error 0,CR_SERVER_LOST,ER_INTERNAL_ERROR
106 ALTER TABLESPACE encrypt_ts ENCRYPTION='Y';
107
108 --echo #########################################################################
109 --echo # RESTART $rc : WITH KEYRING PLUGIN after crash
110 --echo #########################################################################
111
112 --echo # INJECT error TOO_MANY_CONCURRENT_TXNS in startup location $location.
113 --echo # It will cause FATAL error and server abort.
114 --error 0,2,-2147483645
115 --exec $MYSQLD_CMD --early-plugin-load=keyring_file=$KEYRING_PLUGIN --loose-keyring_file_data=$MYSQL_TMP_DIR/mysecret_keyring $KEYRING_PLUGIN_OPT --log-error=$MYSQLTEST_VARDIR/log/my_restart.err --debug=+d,$location
116
117 --echo # Search the failure pattern in error log
118 --let SEARCH_FILE= $MYSQLTEST_VARDIR/log/my_restart.err
119 --source include/search_pattern.inc
120 --remove_file $MYSQLTEST_VARDIR/log/my_restart.err
121
122 --echo #########################################################################
123 --echo # RESTART $rc : normally
124 --echo #########################################################################
125 let $restart_parameters = restart: --early-plugin-load=keyring_file=$KEYRING_PLUGIN --loose-keyring_file_data=$MYSQL_TMP_DIR/mysecret_keyring $KEYRING_PLUGIN_OPT;
126 --source include/start_mysqld_no_echo.inc
127 --inc $rc
128
129 DROP TABLE t1;
130 DROP TABLESPACE encrypt_ts;
131
132 --echo ###########
133 --echo # Cleanup #
134 --echo ###########
135
136 --echo #########################################################################
137 --echo # RESTART $rc : final
138 --echo #########################################################################
139 --let $restart_parameters = "restart:"
140 --source include/restart_mysqld_no_echo.inc
141 --remove_files_wildcard $MYSQL_TMP_DIR/ mysecret_keyring*
142 --remove_file $MYSQLTEST_VARDIR/tmp/setup.inc