polardbxengine/mysql-test/suite/innodb_undo/t/encrypt_explicit.test

116 lines
3.8 KiB
Plaintext

--echo #
--echo # wl9508: Show that explicit and implicit undo tablespaces can be encrypted.
--echo #
--source include/have_innodb_16k.inc
let $MYSQLD_BASEDIR= `select @@basedir`;
let $MYSQLD_OLD_DATADIR = `select @@datadir`;
use test;
CREATE table tab1(c1 int);
--mkdir $MYSQL_TMP_DIR/log_encrypt_dir1
let $MYSQLD_DATADIR1 = $MYSQL_TMP_DIR/log_encrypt_dir1;
let BOOTSTRAP_SQL=$MYSQL_TMP_DIR/boot.sql;
--echo # create bootstrap file
write_file $BOOTSTRAP_SQL;
CREATE DATABASE test;
EOF
--echo # Stop the MTR default DB server
--source include/shutdown_mysqld.inc
let NEW_CMD = $MYSQLD --no-defaults --initialize-insecure --basedir=$MYSQLD_BASEDIR --datadir=$MYSQLD_DATADIR1 --init-file=$BOOTSTRAP_SQL --secure-file-priv="" --cluster-id=1 --cluster-start-index=1 --cluster-info='127.0.0.1:29230@1' </dev/null>>$MYSQLTEST_VARDIR/tmp/bootstrap1.log 2>&1;
--echo # Run the bootstrap command of datadir1
--exec $NEW_CMD
--let $restart_parameters="restart: --log_error_verbosity=3 --datadir=$MYSQLD_DATADIR1 --early-plugin-load="keyring_file=$KEYRING_PLUGIN" $KEYRING_PLUGIN_OPT --keyring_file_data=$MYSQL_TMP_DIR/my_keyfile --innodb_undo_log_encrypt=1 --innodb_redo_log_encrypt=1"
--source include/start_mysqld_no_echo.inc
--replace_result $MYSQLD_DATADIR1 MYSQLD_DATADIR1
SELECT @@datadir;
--replace_result $MYSQL_TMP_DIR key_file
SHOW VARIABLES LIKE 'keyring_file%';
SELECT @@innodb_undo_log_encrypt;
CREATE UNDO TABLESPACE undo_003 ADD DATAFILE 'undo_003.ibu';
CREATE DATABASE nath;
use nath;
CREATE TABLE tab2(c1 int , c2 varchar(10)) Engine=InnoDB ENCRYPTION='Y';
INSERT INTO tab2 VALUES(2, 'VISH');
CREATE INDEX ix2 ON tab2(c2) ;
# Assertion failure: space_id == page_get_space_id(buf_block_get_frame(block))
# during wl9508 testing
CREATE UNDO TABLESPACE undo_004 ADD DATAFILE 'undo_004.ibu';
# Check ALTER and DROP with encrypt undo tablespaces
ALTER UNDO TABLESPACE undo_003 SET INACTIVE;
let $inactive_undo_space = undo_003;
source include/wait_until_undo_space_is_empty.inc;
ALTER UNDO TABLESPACE undo_004 SET INACTIVE;
let $inactive_undo_space = undo_004;
source include/wait_until_undo_space_is_empty.inc;
DELETE FROM tab2;
DROP UNDO TABLESPACE undo_003;
DROP UNDO TABLESPACE undo_004;
DROP TABLE tab2;
DROP DATABASE nath;
--echo # Stop the encrypt server
--let $shutdown_server_timeout= 300
--source include/shutdown_mysqld.inc
# Restart with MTR default server
--let $wait_counter= 3000
--replace_result $MYSQLD_OLD_DATADIR OLD_DATADIR
--let $restart_parameters="restart: --datadir=$MYSQLD_OLD_DATADIR"
--source include/start_mysqld.inc
--replace_result $MYSQLD_OLD_DATADIR MYSQLD_OLD_DATADIR
SELECT @@datadir;
use test;
# clean up
DROP TABLE tab1;
--echo #
--echo # bug#29006275 : ENCRYPTION MASTER KEY IS GENERATED WITH BLANK UUID
--echo #
LET $MYSQL_DATA_DIR = `select @@datadir`;
--echo # Stop the encrypt server
--source include/shutdown_mysqld.inc
--echo # Drop existing UNDO tablespaces
--list_files $MYSQL_DATA_DIR/ undo_00*
--remove_file $MYSQL_DATA_DIR/undo_001
--remove_file $MYSQL_DATA_DIR/undo_002
--remove_file $MYSQL_DATA_DIR/undo_003
--remove_file $MYSQL_DATA_DIR/undo_004
--remove_file $MYSQL_DATA_DIR/undo_005
--remove_file $MYSQL_DATA_DIR/undo_006
--echo # Drop existing auto.cnf
--list_files $MYSQL_DATA_DIR/ auto*
--remove_file $MYSQL_DATA_DIR/auto.cnf
--echo # Restart server with keyring plugin and innodb_undo_log_encrypt=ON
# Lizard: innodb_cleanout_safe_mode must be set because we drop undo_001, undo_002
--let $restart_parameters="restart: --log_error_verbosity=3 --early-plugin-load="keyring_file=$KEYRING_PLUGIN" $KEYRING_PLUGIN_OPT --keyring_file_data=$MYSQL_TMP_DIR/my_keyfile --innodb_undo_log_encrypt=1 --innodb_cleanout_safe_mode=1"
--source include/start_mysqld_no_echo.inc
--echo # Show that a master key with a blank Server UUID is not used.
SELECT * FROM performance_schema.keyring_keys where KEY_ID='INNODBKey--1';