| 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 |
# In connection CON1 |
| 7 |
CREATE TABLESPACE tbs; |
| 8 |
CREATE TABLE t1(col1 INT PRIMARY KEY, col2 int, col3 varchar(64), col4 BLOB) |
| 9 |
TABLESPACE = tbs; |
| 10 |
# In connection DEFAULT |
| 11 |
# 1. Enable REDO encryption during PAGE COPY |
| 12 |
SET GLOBAL DEBUG = '+d,clone_ddl_abort_wait_page_copy'; |
| 13 |
SET DEBUG_SYNC = 'clone_page_copy SIGNAL start_ddl WAIT_FOR resume_clone'; |
| 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 |
SET DEBUG_SYNC = 'now WAIT_FOR start_ddl'; |
| 19 |
SET DEBUG_SYNC = 'clone_notify_ddl_after_state_block SIGNAL resume_clone'; |
| 20 |
SET GLOBAL innodb_redo_log_encrypt = ON; |
| 21 |
ERROR HY000: Internal error: Simulated Clone DDL error |
| 22 |
# In connection DEFAULT |
| 23 |
SET GLOBAL DEBUG = '-d,clone_ddl_abort_wait_page_copy'; |
| 24 |
SET DEBUG_SYNC = 'RESET'; |
| 25 |
# 2. Enable UNDO encryption during PAGE COPY |
| 26 |
SET GLOBAL DEBUG = '+d,clone_ddl_abort_wait_page_copy'; |
| 27 |
SET DEBUG_SYNC = 'clone_page_copy SIGNAL start_ddl WAIT_FOR resume_clone'; |
| 28 |
SET GLOBAL clone_autotune_concurrency = OFF; |
| 29 |
SET GLOBAL clone_max_concurrency = 8; |
| 30 |
CLONE LOCAL DATA DIRECTORY = 'CLONE_DATADIR'; |
| 31 |
# In connection CON1 |
| 32 |
SET DEBUG_SYNC = 'now WAIT_FOR start_ddl'; |
| 33 |
SET DEBUG_SYNC = 'clone_notify_ddl_after_state_block SIGNAL resume_clone'; |
| 34 |
SET GLOBAL innodb_undo_log_encrypt = ON; |
| 35 |
ERROR HY000: Internal error: Simulated Clone DDL error |
| 36 |
# In connection DEFAULT |
| 37 |
SET GLOBAL DEBUG = '-d,clone_ddl_abort_wait_page_copy'; |
| 38 |
SET DEBUG_SYNC = 'RESET'; |
| 39 |
# 3. Enable general tablespace encryption during PAGE COPY |
| 40 |
SET GLOBAL DEBUG = '+d,clone_ddl_abort_wait_page_copy'; |
| 41 |
SET DEBUG_SYNC = 'clone_page_copy SIGNAL start_ddl WAIT_FOR resume_clone'; |
| 42 |
SET GLOBAL clone_autotune_concurrency = OFF; |
| 43 |
SET GLOBAL clone_max_concurrency = 8; |
| 44 |
CLONE LOCAL DATA DIRECTORY = 'CLONE_DATADIR'; |
| 45 |
# In connection CON1 |
| 46 |
SET DEBUG_SYNC = 'now WAIT_FOR start_ddl'; |
| 47 |
SET DEBUG_SYNC = 'clone_notify_ddl_after_state_block SIGNAL resume_clone'; |
| 48 |
ALTER TABLESPACE tbs ENCRYPTION = 'Y'; |
| 49 |
# In connection DEFAULT |
| 50 |
ERROR HY000: Concurrent DDL is performed during clone operation. Please try again. |
| 51 |
SET GLOBAL DEBUG = '-d,clone_ddl_abort_wait_page_copy'; |
| 52 |
SET DEBUG_SYNC = 'RESET'; |
| 53 |
# 4.Disable general tablespace encryption during PAGE COPY |
| 54 |
SET GLOBAL DEBUG = '+d,clone_ddl_abort_wait_page_copy'; |
| 55 |
SET DEBUG_SYNC = 'clone_page_copy SIGNAL start_ddl WAIT_FOR resume_clone'; |
| 56 |
SET GLOBAL clone_autotune_concurrency = OFF; |
| 57 |
SET GLOBAL clone_max_concurrency = 8; |
| 58 |
CLONE LOCAL DATA DIRECTORY = 'CLONE_DATADIR'; |
| 59 |
# In connection CON1 |
| 60 |
SET DEBUG_SYNC = 'now WAIT_FOR start_ddl'; |
| 61 |
SET DEBUG_SYNC = 'clone_notify_ddl_after_state_block SIGNAL resume_clone'; |
| 62 |
ALTER TABLESPACE tbs ENCRYPTION = 'N'; |
| 63 |
# In connection DEFAULT |
| 64 |
ERROR HY000: Concurrent DDL is performed during clone operation. Please try again. |
| 65 |
SET GLOBAL DEBUG = '-d,clone_ddl_abort_wait_page_copy'; |
| 66 |
SET DEBUG_SYNC = 'RESET'; |
| 67 |
# Cleanup |
| 68 |
DROP TABLE t1; |
| 69 |
DROP TABLESPACE tbs; |
| 70 |
# Uninstall clone |
| 71 |
UNINSTALL PLUGIN clone; |
| 72 |
# Restart server and remove encrypted data directory |
| 73 |
# restart: |