File: tablespace_encrypt_11.inc

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (141 lines) | stat: -rw-r--r-- 5,914 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
################################################################################
# InnoDB transparent tablespace data encryption for general shared tablespace.
# This test case will test recovery abort on 2 error injection
################################################################################

--source include/big_test.inc
--source include/have_debug.inc
# --source include/no_valgrind_without_big.inc
# Disable in valgrind because of timeout, cf. Bug#22760145
--source include/not_valgrind.inc
# Waiting time when (re)starting the server
--let $explicit_default_wait_counter=10000

--disable_query_log
call mtr.add_suppression("\\[ERROR\\] \\[[^]]*\\] \\[[^]]*\\] Check keyring plugin fail, please check the keyring plugin is loaded.");
call mtr.add_suppression("\\[ERROR\\] \\[[^]]*\\] \\[[^]]*\\] Failed to decrypt encryption information, found unexpected version of it!");
call mtr.add_suppression("\\[Warning\\] \\[MY-013674\\] \\[Innodb\\] Decrypting a page in doublewrite file failed");
call mtr.add_suppression("\\[Warning\\] \\[MY-013675\\] \\[Innodb\\] Encryption key missing");
--enable_query_log

--write_file $MYSQLTEST_VARDIR/tmp/setup.inc EXECUTE_STEP
  # Create an Unencrypted tablespace
  CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' ENGINE=InnoDB ENCRYPTION="N";
  # Create an unencrypted table in tablespace
  CREATE TABLE t1(c1 char(100)) ENGINE=InnoDB TABLESPACE encrypt_ts;
  # Insert few rows in table
  --disable_query_log
  INSERT INTO t1 VALUES ("SOME VALUES");
  let $counter=12;
  while ($counter>0)
  {
    INSERT INTO test.t1 SELECT * FROM test.t1;
    dec $counter;
  }
  --enable_query_log

  # Make sure ts file is updated with new records in table
  set global innodb_buf_flush_list_now = 1;

  SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts';
  SELECT * FROM t1 LIMIT 10;
EXECUTE_STEP

--echo #########
--echo # SETUP #
--echo #########

--let $rc=1

--echo #########################################################################
--echo # RESTART $rc : WITH KEYRING PLUGIN
--echo #########################################################################
let $restart_parameters = restart: $PLUGIN_DIR_OPT;
--source include/restart_mysqld_no_echo.inc
--inc $rc

--echo #-------------------------- TEST 1 -------------------------------------#
--let $location=DDL_Log_remove_inject_startup_error_1
--let SEARCH_PATTERN=ENCRYPTION for tablespace encrypt_ts:[0-9]+ could not be done successfully
--source $MYSQLTEST_VARDIR/tmp/setup.inc

--echo # Set Encryption process to crash just after making DDL Entry
SET SESSION debug= '+d,alter_encrypt_tablespace_crash_after_ddl_entry';

--echo # Encrypt the tablespace. It will cause crash.
--source include/expect_crash.inc
--error 0,CR_SERVER_LOST,ER_INTERNAL_ERROR
ALTER TABLESPACE encrypt_ts ENCRYPTION='Y';

--echo #########################################################################
--echo # RESTART $rc : WITH KEYRING PLUGIN after crash
--echo #########################################################################

--echo # INJECT error TOO_MANY_CONCURRENT_TXNS in startup location $location.
--echo # It will cause FATAL error and server abort.
let $restart_parameters = restart: $PLUGIN_DIR_OPT --log-error=$MYSQLTEST_VARDIR/log/my_restart.err --debug=+d,$location;
--source include/start_mysqld_no_echo.inc
--inc $rc

--echo # Search the failure pattern in error log
--let SEARCH_FILE= $MYSQLTEST_VARDIR/log/my_restart.err
--source include/search_pattern.inc

DROP TABLE t1;
DROP TABLESPACE encrypt_ts;

--echo #########################################################################
--echo # RESTART $rc : normally
--echo #########################################################################
let $restart_parameters = restart: $PLUGIN_DIR_OPT;
--source include/restart_mysqld_no_echo.inc
--remove_file $MYSQLTEST_VARDIR/log/my_restart.err
--inc $rc

--echo #-------------------------- TEST 2 -------------------------------------#
--let $location=DDL_Log_remove_inject_startup_error_2
--let SEARCH_PATTERN=\[FATAL\] Error in DDL Log recovery during Post-Recovery processing.
--source $MYSQLTEST_VARDIR/tmp/setup.inc

--echo # Set Encryption process to crash just after making DDL Entry
SET SESSION debug= '+d,alter_encrypt_tablespace_crash_after_ddl_entry';

--echo # Encrypt the tablespace. It will cause crash.
--source include/expect_crash.inc
--error 0,CR_SERVER_LOST,ER_INTERNAL_ERROR
ALTER TABLESPACE encrypt_ts ENCRYPTION='Y';

--echo #########################################################################
--echo # RESTART $rc : WITH KEYRING PLUGIN after crash
--echo #########################################################################

--echo # INJECT error TOO_MANY_CONCURRENT_TXNS in startup location $location.
--echo # It will cause FATAL error and server abort.
--error 0,2,-2147483645
--exec $MYSQLD_CMD $PLUGIN_DIR_OPT --log-error=$MYSQLTEST_VARDIR/log/my_restart.err --debug=+d,$location

--echo # Search the failure pattern in error log
--let SEARCH_FILE= $MYSQLTEST_VARDIR/log/my_restart.err
--source include/search_pattern.inc
--remove_file $MYSQLTEST_VARDIR/log/my_restart.err

--echo #########################################################################
--echo # RESTART $rc : normally
--echo #########################################################################
let $restart_parameters = restart: $PLUGIN_DIR_OPT;
--source include/start_mysqld_no_echo.inc
--inc $rc

DROP TABLE t1;
DROP TABLESPACE encrypt_ts;

--echo ###########
--echo # Cleanup #
--echo ###########

--echo #########################################################################
--echo # RESTART $rc : final
--echo #########################################################################
--let $restart_parameters = "restart: $PLUGIN_DIR_OPT"
--source include/restart_mysqld_no_echo.inc
--remove_file $MYSQLTEST_VARDIR/tmp/setup.inc