| 1 |
# Prepare for creating Encrypted Table |
| 2 |
# create bootstrap file |
| 3 |
# Create and start mysqld with keyring plugin. |
| 4 |
# restart: --datadir=ENCRYPT_DATADIR --early-plugin-load=keyring_file=KEYRING_PLUGIN --keyring_file_data=MYSQL_TMP_DIR/mysecret_keyring |
| 5 |
INSTALL PLUGIN clone SONAME 'CLONE_PLUGIN'; |
| 6 |
SET GLOBAL innodb_ddl_threads = 1; |
| 7 |
CREATE TABLE t1(col1 INT PRIMARY KEY, col2 int, col3 varchar(64), col4 BLOB); |
| 8 |
CREATE TABLE t2(col1 INT PRIMARY KEY, col2 int, col3 varchar(64), col4 BLOB) |
| 9 |
ENCRYPTION = 'Y'; |
| 10 |
CREATE UNDO TABLESPACE undo_02 ADD DATAFILE 'undo_02.ibu'; |
| 11 |
ALTER UNDO TABLESPACE undo_02 SET INACTIVE; |
| 12 |
SET DEBUG_SYNC = 'clone_state_transit_file_copy SIGNAL start_ddl WAIT_FOR resume_clone_file'; |
| 13 |
SET DEBUG_SYNC = 'clone_page_copy SIGNAL start_ddl_inplace WAIT_FOR resume_clone_page'; |
| 14 |
SET GLOBAL clone_autotune_concurrency = OFF; |
| 15 |
SET GLOBAL clone_max_concurrency = 8; |
| 16 |
CLONE LOCAL DATA DIRECTORY = 'CLONE_DATADIR'; |
| 17 |
# In connection CON1 |
| 18 |
# In connection CON2 |
| 19 |
# Waiting for clone to reach state transition |
| 20 |
SET DEBUG_SYNC = 'now WAIT_FOR start_ddl'; |
| 21 |
# Wait finished |
| 22 |
# 1. CREATE TABLE |
| 23 |
SET DEBUG_SYNC = 'clone_notify_ddl SIGNAL kill_ddl'; |
| 24 |
CREATE TABLE t3(col1 INT PRIMARY KEY, col2 int, col3 varchar(64), col4 BLOB); |
| 25 |
# In connection CON1 |
| 26 |
# Waiting for DDL to reach notification |
| 27 |
SET DEBUG_SYNC = 'now WAIT_FOR kill_ddl'; |
| 28 |
# Wait finished |
| 29 |
KILL QUERY CON_ID; |
| 30 |
# In connection CON2 |
| 31 |
# Waiting for DDL to exit with error |
| 32 |
ERROR 70100: Query execution was interrupted |
| 33 |
# Query should no longer be interrupted and should pass |
| 34 |
# Wait finished |
| 35 |
SET DEBUG_SYNC = 'RESET'; |
| 36 |
# 2A. ALTER TABLE COPY |
| 37 |
SET DEBUG_SYNC = 'clone_notify_ddl SIGNAL kill_ddl'; |
| 38 |
ALTER TABLE t1 ADD INDEX col2_idx(col2), ALGORITHM = COPY; |
| 39 |
# In connection CON1 |
| 40 |
# Waiting for DDL to reach notification |
| 41 |
SET DEBUG_SYNC = 'now WAIT_FOR kill_ddl'; |
| 42 |
# Wait finished |
| 43 |
KILL QUERY CON_ID; |
| 44 |
# In connection CON2 |
| 45 |
# Waiting for DDL to exit with error |
| 46 |
ERROR 70100: Query execution was interrupted |
| 47 |
# Query should no longer be interrupted and should pass |
| 48 |
# Wait finished |
| 49 |
SET DEBUG_SYNC = 'RESET'; |
| 50 |
# 2B. ALTER TABLE IN PLACE |
| 51 |
SET DEBUG_SYNC = 'clone_notify_ddl SIGNAL kill_ddl'; |
| 52 |
ALTER TABLE t1 ADD INDEX col2_idx(col2), ALGORITHM = INPLACE; |
| 53 |
# In connection CON1 |
| 54 |
# Waiting for DDL to reach notification |
| 55 |
SET DEBUG_SYNC = 'now WAIT_FOR kill_ddl'; |
| 56 |
# Wait finished |
| 57 |
KILL QUERY CON_ID; |
| 58 |
# In connection CON2 |
| 59 |
# Waiting for DDL to exit with error |
| 60 |
ERROR 70100: Query execution was interrupted |
| 61 |
# Query should no longer be interrupted and should pass |
| 62 |
# Wait finished |
| 63 |
SET DEBUG_SYNC = 'RESET'; |
| 64 |
# 3. ALTER TABLE RENAME |
| 65 |
SET DEBUG_SYNC = 'clone_notify_ddl SIGNAL kill_ddl'; |
| 66 |
ALTER TABLE t1 RENAME t3; |
| 67 |
# In connection CON1 |
| 68 |
# Waiting for DDL to reach notification |
| 69 |
SET DEBUG_SYNC = 'now WAIT_FOR kill_ddl'; |
| 70 |
# Wait finished |
| 71 |
KILL QUERY CON_ID; |
| 72 |
# In connection CON2 |
| 73 |
# Waiting for DDL to exit with error |
| 74 |
ERROR 70100: Query execution was interrupted |
| 75 |
# Query should no longer be interrupted and should pass |
| 76 |
# Wait finished |
| 77 |
SET DEBUG_SYNC = 'RESET'; |
| 78 |
# 4. TRUNCATE TABLE |
| 79 |
SET DEBUG_SYNC = 'clone_notify_ddl SIGNAL kill_ddl'; |
| 80 |
TRUNCATE TABLE t1; |
| 81 |
# In connection CON1 |
| 82 |
# Waiting for DDL to reach notification |
| 83 |
SET DEBUG_SYNC = 'now WAIT_FOR kill_ddl'; |
| 84 |
# Wait finished |
| 85 |
KILL QUERY CON_ID; |
| 86 |
# In connection CON2 |
| 87 |
# Waiting for DDL to exit with error |
| 88 |
ERROR 70100: Query execution was interrupted |
| 89 |
# Query should no longer be interrupted and should pass |
| 90 |
# Wait finished |
| 91 |
SET DEBUG_SYNC = 'RESET'; |
| 92 |
# 5A. ALTER ENABLE Encryption |
| 93 |
SET DEBUG_SYNC = 'clone_notify_ddl SIGNAL kill_ddl'; |
| 94 |
ALTER TABLE t1 ENCRYPTION = "Y"; |
| 95 |
# In connection CON1 |
| 96 |
# Waiting for DDL to reach notification |
| 97 |
SET DEBUG_SYNC = 'now WAIT_FOR kill_ddl'; |
| 98 |
# Wait finished |
| 99 |
KILL QUERY CON_ID; |
| 100 |
# In connection CON2 |
| 101 |
# Waiting for DDL to exit with error |
| 102 |
ERROR 70100: Query execution was interrupted |
| 103 |
# Query should no longer be interrupted and should pass |
| 104 |
# Wait finished |
| 105 |
SET DEBUG_SYNC = 'RESET'; |
| 106 |
# 5B. ALTER DISABLE ENCRYPTION |
| 107 |
SET DEBUG_SYNC = 'clone_notify_ddl SIGNAL kill_ddl'; |
| 108 |
ALTER TABLE t2 ENCRYPTION = "N"; |
| 109 |
# In connection CON1 |
| 110 |
# Waiting for DDL to reach notification |
| 111 |
SET DEBUG_SYNC = 'now WAIT_FOR kill_ddl'; |
| 112 |
# Wait finished |
| 113 |
KILL QUERY CON_ID; |
| 114 |
# In connection CON2 |
| 115 |
# Waiting for DDL to exit with error |
| 116 |
ERROR 70100: Query execution was interrupted |
| 117 |
# Query should no longer be interrupted and should pass |
| 118 |
# Wait finished |
| 119 |
SET DEBUG_SYNC = 'RESET'; |
| 120 |
# 6. CREATE UNDO TABLESPACE |
| 121 |
SET DEBUG_SYNC = 'clone_notify_ddl SIGNAL kill_ddl'; |
| 122 |
CREATE UNDO TABLESPACE undo_01 ADD DATAFILE 'undo_01.ibu'; |
| 123 |
# In connection CON1 |
| 124 |
# Waiting for DDL to reach notification |
| 125 |
SET DEBUG_SYNC = 'now WAIT_FOR kill_ddl'; |
| 126 |
# Wait finished |
| 127 |
KILL QUERY CON_ID; |
| 128 |
# In connection CON2 |
| 129 |
# Waiting for DDL to exit with error |
| 130 |
ERROR 70100: Query execution was interrupted |
| 131 |
# Query should no longer be interrupted and should pass |
| 132 |
# Wait finished |
| 133 |
SET DEBUG_SYNC = 'RESET'; |
| 134 |
# 7A. ENABLE REDO ENCRYPTION |
| 135 |
SET DEBUG_SYNC = 'clone_notify_ddl SIGNAL kill_ddl'; |
| 136 |
SET GLOBAL innodb_redo_log_encrypt = ON; |
| 137 |
# In connection CON1 |
| 138 |
# Waiting for DDL to reach notification |
| 139 |
SET DEBUG_SYNC = 'now WAIT_FOR kill_ddl'; |
| 140 |
# Wait finished |
| 141 |
KILL QUERY CON_ID; |
| 142 |
# In connection CON2 |
| 143 |
# Waiting for DDL to exit with error |
| 144 |
ERROR 70100: Query execution was interrupted |
| 145 |
# Query should no longer be interrupted and should pass |
| 146 |
# Wait finished |
| 147 |
SET DEBUG_SYNC = 'RESET'; |
| 148 |
# 7B. ENABLE UNDO ENCRYPTION |
| 149 |
SET DEBUG_SYNC = 'clone_notify_ddl SIGNAL kill_ddl'; |
| 150 |
SET GLOBAL innodb_undo_log_encrypt = ON; |
| 151 |
# In connection CON1 |
| 152 |
# Waiting for DDL to reach notification |
| 153 |
SET DEBUG_SYNC = 'now WAIT_FOR kill_ddl'; |
| 154 |
# Wait finished |
| 155 |
KILL QUERY CON_ID; |
| 156 |
# In connection CON2 |
| 157 |
# Waiting for DDL to exit with error |
| 158 |
ERROR 70100: Query execution was interrupted |
| 159 |
# Query should no longer be interrupted and should pass |
| 160 |
# Wait finished |
| 161 |
SET DEBUG_SYNC = 'RESET'; |
| 162 |
SET DEBUG_SYNC = 'now SIGNAL resume_clone_file'; |
| 163 |
# Waiting for clone to reach page copy state |
| 164 |
SET DEBUG_SYNC = 'now WAIT_FOR start_ddl_inplace'; |
| 165 |
# Wait finished |
| 166 |
# 8. ALTER TABLE INPLACE during PAGE COPY |
| 167 |
SET DEBUG_SYNC = 'clone_notify_ddl SIGNAL kill_ddl'; |
| 168 |
ALTER TABLE t1 ADD INDEX col2_idx(col2), ALGORITHM = INPLACE; |
| 169 |
# In connection CON1 |
| 170 |
# Waiting for DDL to reach notification |
| 171 |
SET DEBUG_SYNC = 'now WAIT_FOR kill_ddl'; |
| 172 |
# Wait finished |
| 173 |
KILL QUERY CON_ID; |
| 174 |
# In connection CON2 |
| 175 |
# Waiting for DDL to exit with error |
| 176 |
ERROR 70100: Query execution was interrupted |
| 177 |
# Query should no longer be interrupted and should pass |
| 178 |
# Wait finished |
| 179 |
SET DEBUG_SYNC = 'RESET'; |
| 180 |
SET DEBUG_SYNC = 'now SIGNAL resume_clone_page'; |
| 181 |
# 9A. DROP TABLE |
| 182 |
SET DEBUG_SYNC = 'clone_notify_ddl SIGNAL kill_ddl'; |
| 183 |
DROP TABLE t1; |
| 184 |
# In connection CON1 |
| 185 |
# Waiting for DDL to reach notification |
| 186 |
SET DEBUG_SYNC = 'now WAIT_FOR kill_ddl'; |
| 187 |
# Wait finished |
| 188 |
KILL QUERY CON_ID; |
| 189 |
# In connection CON2 |
| 190 |
# Query should no longer be interrupted and should pass |
| 191 |
# Wait finished |
| 192 |
SET DEBUG_SYNC = 'RESET'; |
| 193 |
# 9B. DROP UNDO TABLESPACE |
| 194 |
SET DEBUG_SYNC = 'clone_notify_ddl SIGNAL kill_ddl'; |
| 195 |
DROP UNDO TABLESPACE undo_02; |
| 196 |
# In connection CON1 |
| 197 |
# Waiting for DDL to reach notification |
| 198 |
SET DEBUG_SYNC = 'now WAIT_FOR kill_ddl'; |
| 199 |
# Wait finished |
| 200 |
KILL QUERY CON_ID; |
| 201 |
# In connection CON2 |
| 202 |
# Query should no longer be interrupted and should pass |
| 203 |
# Wait finished |
| 204 |
SET DEBUG_SYNC = 'RESET'; |
| 205 |
# In connection default |
| 206 |
# Waiting for Clone to complete |
| 207 |
# Wait finished |
| 208 |
# Cleanup |
| 209 |
DROP TABLE t2; |
| 210 |
SET DEBUG_SYNC = 'RESET'; |
| 211 |
# Uninstall clone |
| 212 |
UNINSTALL PLUGIN clone; |
| 213 |
SET GLOBAL innodb_ddl_threads = default; |
| 214 |
# Restart server and remove encrypted data directory |
| 215 |
# restart: |