| 1 |
# ---------------------------------------------------------------------- |
| 2 |
# Setup |
| 3 |
# Creating local configuration file for keyring component: component_keyring_file |
| 4 |
# Creating manifest file for current MySQL server instance |
| 5 |
# Re-starting mysql server with manifest file |
| 6 |
# ---------------------------------------------------------------------- |
| 7 |
######################################################################### |
| 8 |
# START : WITHOUT KEYRING PLUGIN |
| 9 |
######################################################################### |
| 10 |
# Taking backup of local manifest file for MySQL server instance |
| 11 |
######### |
| 12 |
# SETUP # |
| 13 |
######### |
| 14 |
CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' ENGINE=InnoDB ENCRYPTION="N"; |
| 15 |
CREATE TABLE t1(c1 char(100)) ENGINE=InnoDB TABLESPACE encrypt_ts; |
| 16 |
set global innodb_buf_flush_list_now = 1; |
| 17 |
SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; |
| 18 |
NAME ENCRYPTION |
| 19 |
encrypt_ts N |
| 20 |
SELECT * FROM t1 LIMIT 10; |
| 21 |
c1 |
| 22 |
SOME VALUES |
| 23 |
SOME VALUES |
| 24 |
SOME VALUES |
| 25 |
SOME VALUES |
| 26 |
SOME VALUES |
| 27 |
SOME VALUES |
| 28 |
SOME VALUES |
| 29 |
SOME VALUES |
| 30 |
SOME VALUES |
| 31 |
SOME VALUES |
| 32 |
ALTER TABLESPACE encrypt_ts ENCRYPTION='Y'; |
| 33 |
ERROR HY000: Can't find master key from keyring, please check in the server log if a keyring is loaded and initialized successfully. |
| 34 |
############################################################# |
| 35 |
# TEST 1 : CRASH DURING ALTER ENCRYPT A TABLESPACE. |
| 36 |
############################################################# |
| 37 |
|
| 38 |
######################################################################### |
| 39 |
# RESTART 1 : WITH KEYRING PLUGIN |
| 40 |
######################################################################### |
| 41 |
# Restore local manifest file for MySQL server instance from backup |
| 42 |
############################################################ |
| 43 |
# ALTER TABLESPACE 1 : Unencrypted => Encrypted # |
| 44 |
# (crash at page 10) # |
| 45 |
############################################################ |
| 46 |
# Set Encryption process to crash at page 10 |
| 47 |
SET SESSION debug= '+d,alter_encrypt_tablespace_page_10'; |
| 48 |
SET GLOBAL innodb_log_checkpoint_now = ON; |
| 49 |
SET GLOBAL innodb_page_cleaner_disabled_debug = 1; |
| 50 |
SET GLOBAL innodb_dict_stats_disabled_debug = 1; |
| 51 |
SET GLOBAL innodb_master_thread_disabled_debug = 1; |
| 52 |
# Encrypt the tablespace. It will cause crash. |
| 53 |
ALTER TABLESPACE encrypt_ts ENCRYPTION='Y'; |
| 54 |
# Restart after crash without Keyring plugin loaded |
| 55 |
# Taking backup of local manifest file for MySQL server instance |
| 56 |
Pattern "CORRUPT LOG RECORD FOUND" found |
| 57 |
# Server shouldn't have restarted, so query should fail. |
| 58 |
SELECT * from test.t1 limit 10; |
| 59 |
Got one of the listed errors |
| 60 |
######################################################################### |
| 61 |
# RESTART 2 : WITH KEYRING PLUGIN |
| 62 |
######################################################################### |
| 63 |
# Restore local manifest file for MySQL server instance from backup |
| 64 |
# Server should have restarted properly. |
| 65 |
SELECT * from test.t1 limit 10; |
| 66 |
c1 |
| 67 |
SOME VALUES |
| 68 |
SOME VALUES |
| 69 |
SOME VALUES |
| 70 |
SOME VALUES |
| 71 |
SOME VALUES |
| 72 |
SOME VALUES |
| 73 |
SOME VALUES |
| 74 |
SOME VALUES |
| 75 |
SOME VALUES |
| 76 |
SOME VALUES |
| 77 |
########### |
| 78 |
# Cleanup # |
| 79 |
########### |
| 80 |
DROP TABLE t1; |
| 81 |
DROP TABLESPACE encrypt_ts; |
| 82 |
# ---------------------------------------------------------------------- |
| 83 |
# Teardown |
| 84 |
# Removing manifest file for current MySQL server instance |
| 85 |
# Removing local keyring file for keyring component: component_keyring_file |
| 86 |
# Removing local configuration file for keyring component: component_keyring_file |
| 87 |
# Restarting server without the manifest file |
| 88 |
# ---------------------------------------------------------------------- |