| 1 |
################################################################################ |
| 2 |
# InnoDB transparent tablespace data encryption for general shared tablespace. |
| 3 |
# This test case will test |
| 4 |
# - Situation to encrypt a tablespace which has half initialized page. |
| 5 |
################################################################################ |
| 6 |
--source include/no_valgrind_without_big.inc |
| 7 |
--source include/have_debug.inc |
| 8 |
# Waiting time when (re)starting the server |
| 9 |
--let $explicit_default_wait_counter=10000 |
| 10 |
|
| 11 |
--echo ######################################################################### |
| 12 |
--echo # RESTART 1 : WITH KEYRING PLUGIN |
| 13 |
--echo ######################################################################### |
| 14 |
let $restart_parameters = restart: |
| 15 |
--early-plugin-load=keyring_file=$KEYRING_PLUGIN --loose-keyring_file_data=$MYSQL_TMP_DIR/mysecret_keyring $KEYRING_PLUGIN_OPT --performance-schema-consumer-events-stages-current=ON --performance-schema-events-stages-history-size=1000; |
| 16 |
--source include/restart_mysqld_no_echo.inc |
| 17 |
|
| 18 |
SET SESSION debug= '+d,ddl_btree_build_insert_return_interrupt'; |
| 19 |
|
| 20 |
--echo |
| 21 |
--echo ######### |
| 22 |
--echo # SETUP # |
| 23 |
--echo ######### |
| 24 |
|
| 25 |
# Create Insert Procedure |
| 26 |
DELIMITER |; |
| 27 |
CREATE PROCEDURE populate_t1() |
| 28 |
BEGIN |
| 29 |
DECLARE i int DEFAULT 1; |
| 30 |
|
| 31 |
START TRANSACTION; |
| 32 |
WHILE (i <= 10000) DO |
| 33 |
INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); |
| 34 |
SET i = i + 1; |
| 35 |
END WHILE; |
| 36 |
COMMIT; |
| 37 |
END| |
| 38 |
DELIMITER ;| |
| 39 |
|
| 40 |
# Create an encrypted table in tablespace |
| 41 |
CREATE TABLE t1(class INT, id INT, title VARCHAR(100)) encryption='N'; |
| 42 |
|
| 43 |
-- disable_query_log |
| 44 |
CALL populate_t1(); |
| 45 |
-- enable_query_log |
| 46 |
|
| 47 |
# Create an encrypted tablespace |
| 48 |
CREATE TABLESPACE encrypt_ts ADD DATAFILE 'encrypt_ts.ibd' encryption='N'; |
| 49 |
|
| 50 |
--error ER_QUERY_INTERRUPTED |
| 51 |
ALTER TABLE t1 TABLESPACE=encrypt_ts, ALGORITHM=INPLACE; |
| 52 |
|
| 53 |
ALTER TABLESPACE encrypt_ts ENCRYPTION='Y'; |
| 54 |
|
| 55 |
--echo ######################################################################### |
| 56 |
--echo # RESTART 2 : WITH KEYRING PLUGIN |
| 57 |
--echo ######################################################################### |
| 58 |
let $restart_parameters = restart: |
| 59 |
--early-plugin-load=keyring_file=$KEYRING_PLUGIN --loose-keyring_file_data=$MYSQL_TMP_DIR/mysecret_keyring $KEYRING_PLUGIN_OPT --performance-schema-consumer-events-stages-current=ON --performance-schema-events-stages-history-size=1000; |
| 60 |
--source include/restart_mysqld_no_echo.inc |
| 61 |
|
| 62 |
ALTER TABLESPACE encrypt_ts ENCRYPTION='N'; |
| 63 |
|
| 64 |
--echo ########### |
| 65 |
--echo # Cleanup # |
| 66 |
--echo ########### |
| 67 |
DROP TABLE t1; |
| 68 |
DROP TABLESPACE encrypt_ts; |
| 69 |
DROP PROCEDURE populate_t1; |
| 70 |
--remove_file $MYSQL_TMP_DIR/mysecret_keyring |
| 71 |
|
| 72 |
--echo # Restarting server without keyring plugin to restore server state |
| 73 |
let $restart_parameters = restart: ; |
| 74 |
--source include/restart_mysqld.inc |