Commit 55eb7120 authored by Jan Lindström's avatar Jan Lindström

MDEV-11218: encryption.innodb_encryption_discard_import failed in buildbot

Try to stabilize test cases. These test behave badly when run in certain order.
parent c51c885d
call mtr.add_suppression("InnoDB: Table .* tablespace is set as discarded"); call mtr.add_suppression("InnoDB: Tablespace for table .* is set as discarded.");
call mtr.add_suppression("InnoDB: Table .* tablespace is set as discarded.");
call mtr.add_suppression("InnoDB: Cannot calculate statistics for table .* because the .ibd file is missing. Please refer to .* for how to resolve the issue.");
SET GLOBAL innodb_file_format = `Barracuda`; SET GLOBAL innodb_file_format = `Barracuda`;
SET GLOBAL innodb_file_per_table = ON; SET GLOBAL innodb_file_per_table = ON;
set global innodb_compression_algorithm = 1; set global innodb_compression_algorithm = 1;
...@@ -18,15 +20,12 @@ FLUSH TABLE t1 FOR EXPORT; ...@@ -18,15 +20,12 @@ FLUSH TABLE t1 FOR EXPORT;
t1.cfg t1.cfg
t1.frm t1.frm
t1.ibd t1.ibd
backup: t1
UNLOCK TABLES; UNLOCK TABLES;
# Tablespaces should be still encrypted
# t1 yes on expecting NOT FOUND
NOT FOUND /foobar/ in t1.ibd
ALTER TABLE t1 DISCARD TABLESPACE; ALTER TABLE t1 DISCARD TABLESPACE;
restore: t1 .ibd and .cfg files
SET GLOBAL innodb_file_format = `Barracuda`; SET GLOBAL innodb_file_format = `Barracuda`;
SET GLOBAL innodb_file_per_table = ON; SET GLOBAL innodb_file_per_table = ON;
# List after t1 DISCARD
t1.frm
ALTER TABLE t1 IMPORT TABLESPACE; ALTER TABLE t1 IMPORT TABLESPACE;
ERROR HY000: Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB ERROR HY000: Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
......
call mtr.add_suppression("InnoDB: Table .* tablespace is set as discarded"); call mtr.add_suppression("InnoDB: Tablespace for table .* is set as discarded.");
call mtr.add_suppression("InnoDB: Cannot calculate statistics for table .* because the .ibd file is missing. Please refer to .* for how to resolve the issue.");
SET GLOBAL innodb_file_format = `Barracuda`; SET GLOBAL innodb_file_format = `Barracuda`;
SET GLOBAL innodb_file_per_table = ON; SET GLOBAL innodb_file_per_table = ON;
SET GLOBAL innodb_compression_algorithm = 1; SET GLOBAL innodb_compression_algorithm = 1;
...@@ -57,31 +58,32 @@ t3.ibd ...@@ -57,31 +58,32 @@ t3.ibd
t4.cfg t4.cfg
t4.frm t4.frm
t4.ibd t4.ibd
backup: t1
backup: t2
backup: t3
backup: t4
t1.cfg
t1.frm
t1.ibd
t2.cfg
t2.frm
t2.ibd
t3.cfg
t3.frm
t3.ibd
t4.cfg
t4.frm
t4.ibd
UNLOCK TABLES; UNLOCK TABLES;
# tables should be either encrypted and/or compressed
# t1 yes on expecting NOT FOUND
NOT FOUND /foobar/ in t1.ibd
# t2 yes on expecting NOT FOUND
NOT FOUND /barfoo/ in t2.ibd
# t3 yes on expecting NOT FOUND
NOT FOUND /tmpres/ in t3.ibd
# t4 yes on expecting NOT FOUND
NOT FOUND /mysql/ in t4.ibd
ALTER TABLE t1 DISCARD TABLESPACE; ALTER TABLE t1 DISCARD TABLESPACE;
ALTER TABLE t2 DISCARD TABLESPACE; ALTER TABLE t2 DISCARD TABLESPACE;
ALTER TABLE t3 DISCARD TABLESPACE; ALTER TABLE t3 DISCARD TABLESPACE;
ALTER TABLE t4 DISCARD TABLESPACE; ALTER TABLE t4 DISCARD TABLESPACE;
SET GLOBAL innodb_file_format = `Barracuda`; restore: t1 .ibd and .cfg files
SET GLOBAL innodb_file_per_table = ON; restore: t2 .ibd and .cfg files
SET GLOBAL innodb_compression_algorithm = 1; restore: t3 .ibd and .cfg files
# List after t1 DISCARD restore: t4 .ibd and .cfg files
t1.frm
t2.frm
t3.frm
t4.frm
ALTER TABLE t1 IMPORT TABLESPACE; ALTER TABLE t1 IMPORT TABLESPACE;
Warnings:
Warning 1814 Tablespace has been discarded for table 't1'
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
...@@ -92,8 +94,6 @@ SELECT COUNT(*) FROM t1; ...@@ -92,8 +94,6 @@ SELECT COUNT(*) FROM t1;
COUNT(*) COUNT(*)
2000 2000
ALTER TABLE t2 IMPORT TABLESPACE; ALTER TABLE t2 IMPORT TABLESPACE;
Warnings:
Warning 1814 Tablespace has been discarded for table 't2'
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
...@@ -104,8 +104,6 @@ SELECT COUNT(*) FROM t2; ...@@ -104,8 +104,6 @@ SELECT COUNT(*) FROM t2;
COUNT(*) COUNT(*)
2000 2000
ALTER TABLE t3 IMPORT TABLESPACE; ALTER TABLE t3 IMPORT TABLESPACE;
Warnings:
Warning 1814 Tablespace has been discarded for table 't3'
SHOW CREATE TABLE t3; SHOW CREATE TABLE t3;
Table Create Table Table Create Table
t3 CREATE TABLE `t3` ( t3 CREATE TABLE `t3` (
...@@ -116,8 +114,6 @@ SELECT COUNT(*) FROM t3; ...@@ -116,8 +114,6 @@ SELECT COUNT(*) FROM t3;
COUNT(*) COUNT(*)
2000 2000
ALTER TABLE t4 IMPORT TABLESPACE; ALTER TABLE t4 IMPORT TABLESPACE;
Warnings:
Warning 1814 Tablespace has been discarded for table 't4'
SHOW CREATE TABLE t4; SHOW CREATE TABLE t4;
Table Create Table Table Create Table
t4 CREATE TABLE `t4` ( t4 CREATE TABLE `t4` (
...@@ -127,10 +123,6 @@ t4 CREATE TABLE `t4` ( ...@@ -127,10 +123,6 @@ t4 CREATE TABLE `t4` (
SELECT COUNT(*) FROM t4; SELECT COUNT(*) FROM t4;
COUNT(*) COUNT(*)
2000 2000
flush data to disk
SET GLOBAL innodb_file_format = `Barracuda`;
SET GLOBAL innodb_file_per_table = ON;
SET GLOBAL innodb_compression_algorithm = 1;
# tables should be still either encrypted and/or compressed # tables should be still either encrypted and/or compressed
# t1 yes on expecting NOT FOUND # t1 yes on expecting NOT FOUND
NOT FOUND /foobar/ in t1.ibd NOT FOUND /foobar/ in t1.ibd
......
...@@ -97,14 +97,6 @@ t3 CREATE TABLE `t3` ( ...@@ -97,14 +97,6 @@ t3 CREATE TABLE `t3` (
`a` varchar(255) DEFAULT NULL, `a` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED `encrypted`=yes ) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED `encrypted`=yes
# Wait max 10 min for key encryption threads to encrypt all spaces
# Tablespaces should be encrypted after alter table
# t1 yes on expecting NOT FOUND
NOT FOUND /foobar/ in t1.ibd
# t2 ... on expecting NOT FOUND
NOT FOUND /temp/ in t2.ibd
# t3 ... on expecting NOT FOUND
NOT FOUND /barfoo/ in t3.ibd
# Restarting server # Restarting server
# Done restarting server # Done restarting server
# Verify that tables are still usable # Verify that tables are still usable
...@@ -124,5 +116,8 @@ NOT FOUND /foobar/ in t1.ibd ...@@ -124,5 +116,8 @@ NOT FOUND /foobar/ in t1.ibd
NOT FOUND /temp/ in t2.ibd NOT FOUND /temp/ in t2.ibd
# t3 ... on expecting NOT FOUND # t3 ... on expecting NOT FOUND
NOT FOUND /barfoo/ in t3.ibd NOT FOUND /barfoo/ in t3.ibd
# Wait max 10 min for key encryption threads to encrypt all spaces
# Success!
# Restart mysqld --innodb_encrypt_tables=0 --innodb_encryption_threads=0
DROP PROCEDURE innodb_insert_proc; DROP PROCEDURE innodb_insert_proc;
DROP TABLE t1, t2, t3; DROP TABLE t1, t2, t3;
...@@ -8,7 +8,10 @@ ...@@ -8,7 +8,10 @@
# #
# MDEV-8772: Assertion failure in file ha_innodb.cc line 20027 when importing page compressed and encrypted tablespace using incorrect keys # MDEV-8772: Assertion failure in file ha_innodb.cc line 20027 when importing page compressed and encrypted tablespace using incorrect keys
# #
call mtr.add_suppression("InnoDB: Table .* tablespace is set as discarded");
call mtr.add_suppression("InnoDB: Tablespace for table .* is set as discarded.");
call mtr.add_suppression("InnoDB: Table .* tablespace is set as discarded.");
call mtr.add_suppression("InnoDB: Cannot calculate statistics for table .* because the .ibd file is missing. Please refer to .* for how to resolve the issue.");
--disable_query_log --disable_query_log
let $innodb_file_format_orig = `SELECT @@innodb_file_format`; let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
...@@ -32,28 +35,26 @@ EOF ...@@ -32,28 +35,26 @@ EOF
--enable_reconnect --enable_reconnect
--source include/wait_until_connected_again.inc --source include/wait_until_connected_again.inc
--disable_warnings
SET GLOBAL innodb_file_format = `Barracuda`; SET GLOBAL innodb_file_format = `Barracuda`;
SET GLOBAL innodb_file_per_table = ON; SET GLOBAL innodb_file_per_table = ON;
set global innodb_compression_algorithm = 1; set global innodb_compression_algorithm = 1;
--enable_warnings
CREATE TABLE t1 (pk INT PRIMARY KEY, f VARCHAR(255)) ENGINE=InnoDB PAGE_COMPRESSED=1 ENCRYPTED=YES ENCRYPTION_KEY_ID=4; CREATE TABLE t1 (pk INT PRIMARY KEY, f VARCHAR(255)) ENGINE=InnoDB PAGE_COMPRESSED=1 ENCRYPTED=YES ENCRYPTION_KEY_ID=4;
SHOW WARNINGS; SHOW WARNINGS;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
INSERT INTO t1 VALUES (1,'foobar'),(2,'barfoo'); INSERT INTO t1 VALUES (1,'foobar'),(2,'barfoo');
let MYSQLD_DATADIR =`SELECT @@datadir`;
FLUSH TABLE t1 FOR EXPORT; FLUSH TABLE t1 FOR EXPORT;
--echo # List before copying files --echo # List before copying files
--list_files $MYSQLD_DATADIR/test --list_files $MYSQLD_DATADIR/test
--copy_file $MYSQLD_DATADIR/test/t1.cfg $MYSQLD_TMPDIR/t1.cfg perl;
--copy_file $MYSQLD_DATADIR/test/t1.ibd $MYSQLD_TMPDIR/t1.ibd do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_backup_tablespaces("test", "t1");
EOF
UNLOCK TABLES; UNLOCK TABLES;
--sleep 5
--echo # Tablespaces should be still encrypted
--let SEARCH_PATTERN=foobar
--echo # t1 yes on expecting NOT FOUND
-- let SEARCH_FILE=$t1_IBD
-- source include/search_pattern_in_file.inc
ALTER TABLE t1 DISCARD TABLESPACE; ALTER TABLE t1 DISCARD TABLESPACE;
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
...@@ -65,17 +66,21 @@ ALTER TABLE t1 DISCARD TABLESPACE; ...@@ -65,17 +66,21 @@ ALTER TABLE t1 DISCARD TABLESPACE;
4;770A8A65DA156D24EE2A093277530144 4;770A8A65DA156D24EE2A093277530144
EOF EOF
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_discard_tablespaces("test", "t1");
ib_restore_tablespaces("test", "t1");
EOF
--exec echo "restart:--innodb-encrypt-tables --innodb-stats-persistent --plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys2.txt" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --exec echo "restart:--innodb-encrypt-tables --innodb-stats-persistent --plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys2.txt" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--enable_reconnect --enable_reconnect
--source include/wait_until_connected_again.inc --source include/wait_until_connected_again.inc
--source include/restart_mysqld.inc --source include/restart_mysqld.inc
--disable_warnings
SET GLOBAL innodb_file_format = `Barracuda`; SET GLOBAL innodb_file_format = `Barracuda`;
SET GLOBAL innodb_file_per_table = ON; SET GLOBAL innodb_file_per_table = ON;
--echo # List after t1 DISCARD --enable_warnings
--list_files $MYSQLD_DATADIR/test
--copy_file $MYSQLD_TMPDIR/t1.cfg $MYSQLD_DATADIR/test/t1.cfg
--copy_file $MYSQLD_TMPDIR/t1.ibd $MYSQLD_DATADIR/test/t1.ibd
--error ER_GET_ERRMSG --error ER_GET_ERRMSG
ALTER TABLE t1 IMPORT TABLESPACE; ALTER TABLE t1 IMPORT TABLESPACE;
...@@ -105,10 +110,12 @@ EOF ...@@ -105,10 +110,12 @@ EOF
DROP TABLE t1; DROP TABLE t1;
# reset system # reset system
--disable_warnings
--disable_query_log --disable_query_log
EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig; EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig;
EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig; EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig;
--enable_query_log --enable_query_log
--enable_warnings
--remove_file $MYSQLTEST_VARDIR/keys1.txt --remove_file $MYSQLTEST_VARDIR/keys1.txt
--remove_file $MYSQLTEST_VARDIR/keys2.txt --remove_file $MYSQLTEST_VARDIR/keys2.txt
...@@ -10,7 +10,8 @@ ...@@ -10,7 +10,8 @@
# MDEV-8770: Incorrect error message when importing page compressed tablespace # MDEV-8770: Incorrect error message when importing page compressed tablespace
# #
call mtr.add_suppression("InnoDB: Table .* tablespace is set as discarded"); call mtr.add_suppression("InnoDB: Tablespace for table .* is set as discarded.");
call mtr.add_suppression("InnoDB: Cannot calculate statistics for table .* because the .ibd file is missing. Please refer to .* for how to resolve the issue.");
--disable_query_log --disable_query_log
let $innodb_file_format_orig = `SELECT @@innodb_file_format`; let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
...@@ -18,9 +19,11 @@ let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`; ...@@ -18,9 +19,11 @@ let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
let $innodb_compression_algo = `SELECT @@innodb_compression_algorithm`; let $innodb_compression_algo = `SELECT @@innodb_compression_algorithm`;
--enable_query_log --enable_query_log
--disable_warnings
SET GLOBAL innodb_file_format = `Barracuda`; SET GLOBAL innodb_file_format = `Barracuda`;
SET GLOBAL innodb_file_per_table = ON; SET GLOBAL innodb_file_per_table = ON;
SET GLOBAL innodb_compression_algorithm = 1; SET GLOBAL innodb_compression_algorithm = 1;
--enable_warnings
--let $MYSQLD_TMPDIR = `SELECT @@tmpdir` --let $MYSQLD_TMPDIR = `SELECT @@tmpdir`
--let $MYSQLD_DATADIR = `SELECT @@datadir` --let $MYSQLD_DATADIR = `SELECT @@datadir`
...@@ -65,58 +68,28 @@ select count(*) from t2; ...@@ -65,58 +68,28 @@ select count(*) from t2;
select count(*) from t3; select count(*) from t3;
select count(*) from t4; select count(*) from t4;
let MYSQLD_DATADIR =`SELECT @@datadir`;
FLUSH TABLE t1,t2,t3,t4 FOR EXPORT; FLUSH TABLE t1,t2,t3,t4 FOR EXPORT;
--echo # List before copying files --echo # List before copying files
--list_files $MYSQLD_DATADIR/test --list_files $MYSQLD_DATADIR/test
--copy_file $MYSQLD_DATADIR/test/t1.cfg $MYSQLD_TMPDIR/t1.cfg perl;
--copy_file $MYSQLD_DATADIR/test/t1.ibd $MYSQLD_TMPDIR/t1.ibd do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
--copy_file $MYSQLD_DATADIR/test/t2.cfg $MYSQLD_TMPDIR/t2.cfg ib_backup_tablespaces("test", "t1","t2","t3","t4");
--copy_file $MYSQLD_DATADIR/test/t2.ibd $MYSQLD_TMPDIR/t2.ibd EOF
--copy_file $MYSQLD_DATADIR/test/t3.cfg $MYSQLD_TMPDIR/t3.cfg --list_files $MYSQLD_DATADIR/test
--copy_file $MYSQLD_DATADIR/test/t3.ibd $MYSQLD_TMPDIR/t3.ibd
--copy_file $MYSQLD_DATADIR/test/t4.cfg $MYSQLD_TMPDIR/t4.cfg
--copy_file $MYSQLD_DATADIR/test/t4.ibd $MYSQLD_TMPDIR/t4.ibd
UNLOCK TABLES;
--echo # tables should be either encrypted and/or compressed UNLOCK TABLES;
--let SEARCH_PATTERN=foobar
--echo # t1 yes on expecting NOT FOUND
-- let SEARCH_FILE=$t1_IBD
-- source include/search_pattern_in_file.inc
--let SEARCH_PATTERN=barfoo
--echo # t2 yes on expecting NOT FOUND
-- let SEARCH_FILE=$t2_IBD
-- source include/search_pattern_in_file.inc
--let SEARCH_PATTERN=tmpres
--echo # t3 yes on expecting NOT FOUND
-- let SEARCH_FILE=$t3_IBD
-- source include/search_pattern_in_file.inc
--let SEARCH_PATTERN=mysql
--echo # t4 yes on expecting NOT FOUND
-- let SEARCH_FILE=$t4_IBD
-- source include/search_pattern_in_file.inc
ALTER TABLE t1 DISCARD TABLESPACE; ALTER TABLE t1 DISCARD TABLESPACE;
ALTER TABLE t2 DISCARD TABLESPACE; ALTER TABLE t2 DISCARD TABLESPACE;
ALTER TABLE t3 DISCARD TABLESPACE; ALTER TABLE t3 DISCARD TABLESPACE;
ALTER TABLE t4 DISCARD TABLESPACE; ALTER TABLE t4 DISCARD TABLESPACE;
--source include/restart_mysqld.inc perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
SET GLOBAL innodb_file_format = `Barracuda`; ib_discard_tablespaces("test", "t1","t2","t3","t4");
SET GLOBAL innodb_file_per_table = ON; ib_restore_tablespaces("test", "t1","t2","t3","t4");
SET GLOBAL innodb_compression_algorithm = 1; EOF
--echo # List after t1 DISCARD
--list_files $MYSQLD_DATADIR/test
--copy_file $MYSQLD_TMPDIR/t1.cfg $MYSQLD_DATADIR/test/t1.cfg
--copy_file $MYSQLD_TMPDIR/t1.ibd $MYSQLD_DATADIR/test/t1.ibd
--copy_file $MYSQLD_TMPDIR/t2.cfg $MYSQLD_DATADIR/test/t2.cfg
--copy_file $MYSQLD_TMPDIR/t2.ibd $MYSQLD_DATADIR/test/t2.ibd
--copy_file $MYSQLD_TMPDIR/t3.cfg $MYSQLD_DATADIR/test/t3.cfg
--copy_file $MYSQLD_TMPDIR/t3.ibd $MYSQLD_DATADIR/test/t3.ibd
--copy_file $MYSQLD_TMPDIR/t4.cfg $MYSQLD_DATADIR/test/t4.cfg
--copy_file $MYSQLD_TMPDIR/t4.ibd $MYSQLD_DATADIR/test/t4.ibd
ALTER TABLE t1 IMPORT TABLESPACE; ALTER TABLE t1 IMPORT TABLESPACE;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
...@@ -131,13 +104,6 @@ ALTER TABLE t4 IMPORT TABLESPACE; ...@@ -131,13 +104,6 @@ ALTER TABLE t4 IMPORT TABLESPACE;
SHOW CREATE TABLE t4; SHOW CREATE TABLE t4;
SELECT COUNT(*) FROM t4; SELECT COUNT(*) FROM t4;
--echo flush data to disk
--source include/restart_mysqld.inc
SET GLOBAL innodb_file_format = `Barracuda`;
SET GLOBAL innodb_file_per_table = ON;
SET GLOBAL innodb_compression_algorithm = 1;
--echo # tables should be still either encrypted and/or compressed --echo # tables should be still either encrypted and/or compressed
--let SEARCH_PATTERN=foobar --let SEARCH_PATTERN=foobar
--echo # t1 yes on expecting NOT FOUND --echo # t1 yes on expecting NOT FOUND
...@@ -160,8 +126,10 @@ DROP PROCEDURE innodb_insert_proc; ...@@ -160,8 +126,10 @@ DROP PROCEDURE innodb_insert_proc;
DROP TABLE t1,t2,t3,t4; DROP TABLE t1,t2,t3,t4;
# reset system # reset system
--disable_warnings
--disable_query_log --disable_query_log
EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig; EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig;
EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig; EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig;
EVAL SET GLOBAL innodb_compression_algorithm = $innodb_compression_algo; EVAL SET GLOBAL innodb_compression_algorithm = $innodb_compression_algo;
--enable_query_log --enable_query_log
--enable_warnings
...@@ -19,8 +19,10 @@ let $innodb_file_format_orig = `SELECT @@innodb_file_format`; ...@@ -19,8 +19,10 @@ let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`; let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
--enable_query_log --enable_query_log
--disable_warnings
SET GLOBAL innodb_file_format = `Barracuda`; SET GLOBAL innodb_file_format = `Barracuda`;
SET GLOBAL innodb_file_per_table = ON; SET GLOBAL innodb_file_per_table = ON;
--enable_warnings
CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY, a VARCHAR(255)) ENGINE=InnoDB encrypted=yes; CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY, a VARCHAR(255)) ENGINE=InnoDB encrypted=yes;
CREATE TABLE t2 (id INT NOT NULL PRIMARY KEY, a VARCHAR(255)) ENGINE=InnoDB; CREATE TABLE t2 (id INT NOT NULL PRIMARY KEY, a VARCHAR(255)) ENGINE=InnoDB;
...@@ -115,26 +117,6 @@ SHOW CREATE TABLE t2; ...@@ -115,26 +117,6 @@ SHOW CREATE TABLE t2;
ALTER TABLE t3 ENGINE InnoDB; ALTER TABLE t3 ENGINE InnoDB;
SHOW CREATE TABLE t3; SHOW CREATE TABLE t3;
--echo # Wait max 10 min for key encryption threads to encrypt all spaces
--let $wait_timeout= 600
--let $wait_condition=SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0
--source include/wait_condition.inc
--sleep 5
--echo # Tablespaces should be encrypted after alter table
--let SEARCH_PATTERN=foobar
--echo # t1 yes on expecting NOT FOUND
-- let SEARCH_FILE=$t1_IBD
-- source include/search_pattern_in_file.inc
--let SEARCH_PATTERN=temp
--echo # t2 ... on expecting NOT FOUND
-- let SEARCH_FILE=$t2_IBD
-- source include/search_pattern_in_file.inc
--echo # t3 ... on expecting NOT FOUND
--let SEARCH_PATTERN=barfoo
-- let SEARCH_FILE=$t3_IBD
-- source include/search_pattern_in_file.inc
--echo # Restarting server --echo # Restarting server
-- source include/restart_mysqld.inc -- source include/restart_mysqld.inc
--echo # Done restarting server --echo # Done restarting server
...@@ -159,12 +141,23 @@ SELECT COUNT(1) FROM t3; ...@@ -159,12 +141,23 @@ SELECT COUNT(1) FROM t3;
-- let SEARCH_FILE=$t3_IBD -- let SEARCH_FILE=$t3_IBD
-- source include/search_pattern_in_file.inc -- source include/search_pattern_in_file.inc
--echo # Wait max 10 min for key encryption threads to encrypt all spaces
--let $wait_timeout= 600
--let $wait_condition=SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0
--source include/wait_condition.inc
--echo # Success!
--echo # Restart mysqld --innodb_encrypt_tables=0 --innodb_encryption_threads=0
-- let $restart_parameters=--innodb_encrypt_tables=0 --innodb_encryption_threads=0
-- source include/restart_mysqld.inc
DROP PROCEDURE innodb_insert_proc; DROP PROCEDURE innodb_insert_proc;
DROP TABLE t1, t2, t3; DROP TABLE t1, t2, t3;
# reset system # reset system
--disable_warnings
--disable_query_log --disable_query_log
EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig; EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig;
EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig; EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig;
--enable_query_log --enable_query_log
--enable_warnings
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment