--source include/big_test.inc --source include/have_debug.inc # Waiting time when (re)starting the server --let $explicit_default_wait_counter=10000; --disable_query_log call mtr.add_suppression("ibd can't be decrypted, please confirm the keyfile is match and keyring plugin is loaded."); call mtr.add_suppression("\\[Error\\] \\[[^]]*\\] \\[[^]]*\\] Encryption can't find master key, please check the keyring plugin is loaded."); call mtr.add_suppression("\\[ERROR\\] \\[[^]]*\\] \\[[^]]*\\] Check keyring plugin fail, please check the keyring plugin is loaded."); --enable_query_log # 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; --echo --echo ######################################################################### --echo # RESTART 1 : WITH KEYRING PLUGIN --echo ######################################################################### let $restart_parameters = restart: --early-plugin-load=keyring_file=$KEYRING_PLUGIN --loose-keyring_file_data=$MYSQL_TMP_DIR/mysecret_keyring $KEYRING_PLUGIN_OPT; --source include/restart_mysqld_no_echo.inc --echo ############################################################ --echo # ALTER TABLESPACE 1 : Unencrypted => Encrypted # --echo # (crash at page 10) # --echo ############################################################ --echo # Set Encryption process to crash at page 10 --echo # Connection con1: connect (con1,localhost,root,,); connection con1; SELECT connection_id(); connect (con2,localhost,root,,); connection con2; SELECT connection_id(); SET SESSION debug= '+d,alter_encrypt_tablespace_page_10'; --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 # Restart after crash let $restart_parameters = restart: --early-plugin-load=keyring_file=$KEYRING_PLUGIN --loose-keyring_file_data=$MYSQL_TMP_DIR/mysecret_keyring $KEYRING_PLUGIN_OPT --debug=d,sleep_resume_alter_encrypt; --source include/start_mysqld_no_echo.inc #--echo # Wait for Encryption processing to finish in background thread #let $wait_condition = SELECT ENCRYPTION = 'Y' # FROM INFORMATION_SCHEMA.INNODB_TABLESPACES # WHERE NAME='encrypt_ts'; #--source include/wait_condition.inc # Make sure ts file is updated with new records in table set global innodb_buf_flush_list_now = 1; connect (con5,localhost,root,,); connection con5; --echo # Connection con1: connect (con3,localhost,root,,); connection con3; SELECT connection_id(); CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd'; connect (con4,localhost,root,,); connection con4; SELECT connection_id(); ALTER TABLESPACE ts1 ENCRYPTION='Y'; set global innodb_buf_flush_list_now = 1; let $restart_parameters = restart: --early-plugin-load=keyring_file=$KEYRING_PLUGIN --loose-keyring_file_data=$MYSQL_TMP_DIR/mysecret_keyring $KEYRING_PLUGIN_OPT; --source include/kill_and_restart_mysqld.inc --echo # After restart/recovery, check that Encryption was roll-forward SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='encrypt_ts'; SELECT * FROM t1 LIMIT 10; ALTER TABLESPACE encrypt_ts ENCRYPTION='Y'; DROP TABLE t1; DROP TABLESPACE encrypt_ts; --echo # Restarting server without keyring to restore server state let $restart_parameters = restart: ; --source include/restart_mysqld.inc remove_file $MYSQL_TMP_DIR/mysecret_keyring;