File: tablespace_encrypt_9.result

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 (137 lines) | stat: -rw-r--r-- 4,684 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
#########################################################################
# START : WITHOUT KEYRING PLUGIN
#########################################################################

#########
# SETUP #
#########
CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' ENGINE=InnoDB ENCRYPTION="N";
CREATE TABLE t1(c1 char(100)) ENGINE=InnoDB TABLESPACE encrypt_ts;
set global innodb_buf_flush_list_now = 1;
SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts';
NAME	ENCRYPTION
encrypt_ts	N
SELECT * FROM t1 LIMIT 10;
c1
SOME VALUES
SOME VALUES
SOME VALUES
SOME VALUES
SOME VALUES
SOME VALUES
SOME VALUES
SOME VALUES
SOME VALUES
SOME VALUES
ALTER TABLESPACE encrypt_ts ENCRYPTION='Y';
ERROR HY000: Can't find master key from keyring, please check in the server log if a keyring is loaded and initialized successfully.
#############################################################
# TEST 1 : CRASH DURING ALTER ENCRYPT A TABLESPACE.
#############################################################

#########################################################################
# RESTART 1 : WITH KEYRING PLUGIN
#########################################################################
############################################################
# ALTER TABLESPACE 1 :    Unencrypted => Encrypted         #
#                         (crash at page 10)               #
############################################################
# Set Encryption process to crash at page 10
SET SESSION debug= '+d,alter_encrypt_tablespace_page_10';
SET GLOBAL innodb_log_checkpoint_now = ON;
SET GLOBAL innodb_page_cleaner_disabled_debug = 1;
SET GLOBAL innodb_dict_stats_disabled_debug = 1;
SET GLOBAL innodb_master_thread_disabled_debug = 1;
# Encrypt the tablespace. It will cause crash.
ALTER TABLESPACE encrypt_ts ENCRYPTION='Y';
# Restart after crash without Keyring plugin loaded
Pattern "CORRUPT LOG RECORD FOUND" found
# Server shouldn't have restarted, so query should fail.
SELECT * from test.t1 limit 10;
ERROR HY000: Lost connection to MySQL server during query
#########################################################################
# RESTART 2 : WITH KEYRING PLUGIN
#########################################################################
# Server should have restarted properly.
SELECT * from test.t1 limit 10;
c1
SOME VALUES
SOME VALUES
SOME VALUES
SOME VALUES
SOME VALUES
SOME VALUES
SOME VALUES
SOME VALUES
SOME VALUES
SOME VALUES
#
# Bug#30888919 : [INNODB] ASSERTION FAILURE:SPACE->ENCRYPTION_OP_IN_PROGRESS == NONE
#
ALTER TABLESPACE encrypt_ts ENCRYPTION='N';
SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts';
NAME	ENCRYPTION
encrypt_ts	N
SELECT * FROM t1 LIMIT 10;
c1
SOME VALUES
SOME VALUES
SOME VALUES
SOME VALUES
SOME VALUES
SOME VALUES
SOME VALUES
SOME VALUES
SOME VALUES
SOME VALUES
############################################################
# ALTER TABLESPACE :      Unencrypted => Encrypted         #
#                         (crash at page 10)               #
############################################################
# Connection con1:
# Set Encryption process to crash at page 10
SET SESSION debug= '+d,alter_encrypt_tablespace_page_10';
# Encrypt the tablespace. It will cause crash.
ALTER TABLESPACE encrypt_ts ENCRYPTION='Y';
# Restart after crash with sleep_resume_alter_encrypt to make resume
# thread to sleep.
# Connection con2:
# Check that this connection id is same as of the one which was trying
# to encrypt the tablespace before crash.
Connectin ids are same.
CREATE TABLESPACE temp_ts ADD DATAFILE 'temp_ts.ibd';
# connection con3
SELECT connection_id();
connection_id()
10
# Run a DDL with this connection con3
ALTER TABLESPACE temp_ts ENCRYPTION='Y';
set global innodb_buf_flush_list_now = 1;
# Now restart without sleep_resume_alter_encrypt.
# 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
# Wait for Encryption processing to finish in background thread
# After restart/recovery, check that Encryption was roll-forward
SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts';
NAME	ENCRYPTION
encrypt_ts	Y
SELECT * FROM t1 LIMIT 10;
c1
SOME VALUES
SOME VALUES
SOME VALUES
SOME VALUES
SOME VALUES
SOME VALUES
SOME VALUES
SOME VALUES
SOME VALUES
SOME VALUES
# Now try to encrypt tablespace. Without patch, an assert will be hit.
ALTER TABLESPACE encrypt_ts ENCRYPTION='Y';
###########
# Cleanup #
###########
DROP TABLE t1;
DROP TABLESPACE encrypt_ts;
# Restarting server without keyring to restore server state
# restart: