summaryrefslogtreecommitdiff
path: root/mysql-test/suite/encryption/t
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/suite/encryption/t')
-rw-r--r--mysql-test/suite/encryption/t/create_or_replace.test3
-rw-r--r--mysql-test/suite/encryption/t/encrypt_and_grep.opt2
-rw-r--r--mysql-test/suite/encryption/t/encrypt_and_grep.test42
-rw-r--r--mysql-test/suite/encryption/t/encryption.innodb-bad-key-change2.test0
-rw-r--r--mysql-test/suite/encryption/t/filekeys_badtest.inc3
-rw-r--r--mysql-test/suite/encryption/t/filekeys_goodtest.inc2
-rw-r--r--mysql-test/suite/encryption/t/innochecksum.test7
-rw-r--r--mysql-test/suite/encryption/t/innodb-bad-key-change.test66
-rw-r--r--mysql-test/suite/encryption/t/innodb-bad-key-change2.test108
-rw-r--r--mysql-test/suite/encryption/t/innodb-bad-key-change3.test25
-rw-r--r--mysql-test/suite/encryption/t/innodb-bad-key-change4.opt (renamed from mysql-test/suite/encryption/t/innodb-bad-key-change5.opt)0
-rw-r--r--mysql-test/suite/encryption/t/innodb-bad-key-change4.test44
-rw-r--r--mysql-test/suite/encryption/t/innodb-bad-key-change5.test42
-rw-r--r--mysql-test/suite/encryption/t/innodb-bad-key-shutdown.test52
-rw-r--r--mysql-test/suite/encryption/t/innodb-compressed-blob.opt4
-rw-r--r--mysql-test/suite/encryption/t/innodb-compressed-blob.test45
-rw-r--r--mysql-test/suite/encryption/t/innodb-discard-import-change.test13
-rw-r--r--mysql-test/suite/encryption/t/innodb-discard-import.test13
-rw-r--r--mysql-test/suite/encryption/t/innodb-encryption-alter.test8
-rw-r--r--mysql-test/suite/encryption/t/innodb-encryption-disable.test32
-rw-r--r--mysql-test/suite/encryption/t/innodb-force-corrupt.test92
-rw-r--r--mysql-test/suite/encryption/t/innodb-log-encrypt-crash.opt6
-rw-r--r--mysql-test/suite/encryption/t/innodb-log-encrypt-crash.test41
-rw-r--r--mysql-test/suite/encryption/t/innodb-log-encrypt.opt6
-rw-r--r--mysql-test/suite/encryption/t/innodb-log-encrypt.test97
-rw-r--r--mysql-test/suite/encryption/t/innodb-missing-key.test5
-rw-r--r--mysql-test/suite/encryption/t/innodb-page_encryption-32k.test20
-rw-r--r--mysql-test/suite/encryption/t/innodb-page_encryption.test20
-rw-r--r--mysql-test/suite/encryption/t/innodb-page_encryption_compression.test86
-rw-r--r--mysql-test/suite/encryption/t/innodb-page_encryption_log_encryption.test93
-rw-r--r--mysql-test/suite/encryption/t/innodb-redo-badkey.opt5
-rw-r--r--mysql-test/suite/encryption/t/innodb-redo-badkey.test100
-rw-r--r--mysql-test/suite/encryption/t/innodb-redo-nokeys.opt3
-rw-r--r--mysql-test/suite/encryption/t/innodb-redo-nokeys.test80
-rw-r--r--mysql-test/suite/encryption/t/innodb_encryption-page-compression.test70
-rw-r--r--mysql-test/suite/encryption/t/innodb_encryption_discard_import.test21
-rw-r--r--mysql-test/suite/encryption/t/innodb_encryption_filekeys.test9
-rw-r--r--mysql-test/suite/encryption/t/innodb_encryption_is.test14
-rw-r--r--mysql-test/suite/encryption/t/innodb_encryption_row_compressed.test17
-rw-r--r--mysql-test/suite/encryption/t/innodb_encryption_tables.test17
-rw-r--r--mysql-test/suite/encryption/t/innodb_first_page.test17
-rw-r--r--mysql-test/suite/encryption/t/innodb_lotoftables.test7
-rw-r--r--mysql-test/suite/encryption/t/innodb_onlinealter_encryption.opt3
-rw-r--r--mysql-test/suite/encryption/t/innodb_onlinealter_encryption.test15
-rw-r--r--mysql-test/suite/encryption/t/innodb_page_encryption_key_change.test17
-rw-r--r--mysql-test/suite/encryption/t/innodb_scrub.opt2
-rw-r--r--mysql-test/suite/encryption/t/innodb_scrub.test2
-rw-r--r--mysql-test/suite/encryption/t/innodb_scrub_background.opt2
-rw-r--r--mysql-test/suite/encryption/t/tempfiles.test4
49 files changed, 958 insertions, 424 deletions
diff --git a/mysql-test/suite/encryption/t/create_or_replace.test b/mysql-test/suite/encryption/t/create_or_replace.test
index 98d5b7cc017..3b2970e5162 100644
--- a/mysql-test/suite/encryption/t/create_or_replace.test
+++ b/mysql-test/suite/encryption/t/create_or_replace.test
@@ -7,9 +7,6 @@
#
# MDEV-8164: Server crashes in pfs_mutex_enter_func after fil_crypt_is_closing or alike
#
-
-call mtr.add_suppression("InnoDB: Error: trying to do an operation on a dropped tablespace.*");
-
SET default_storage_engine = InnoDB;
CREATE TABLE t1 (pk INT PRIMARY KEY, c VARCHAR(256));
diff --git a/mysql-test/suite/encryption/t/encrypt_and_grep.opt b/mysql-test/suite/encryption/t/encrypt_and_grep.opt
index 5c9aaf65b06..c50ec719307 100644
--- a/mysql-test/suite/encryption/t/encrypt_and_grep.opt
+++ b/mysql-test/suite/encryption/t/encrypt_and_grep.opt
@@ -1,7 +1,7 @@
--innodb-encrypt-tables=ON
--innodb-encrypt-log=ON
--innodb-encryption-rotate-key-age=15
---innodb-encryption-threads=1
+--innodb-encryption-threads=4
--innodb-tablespaces-encryption
diff --git a/mysql-test/suite/encryption/t/encrypt_and_grep.test b/mysql-test/suite/encryption/t/encrypt_and_grep.test
index 2ef69db237d..c5a10620f6e 100644
--- a/mysql-test/suite/encryption/t/encrypt_and_grep.test
+++ b/mysql-test/suite/encryption/t/encrypt_and_grep.test
@@ -14,15 +14,19 @@
--let t3_IBD = $MYSQLD_DATADIR/test/t3.ibd
--let SEARCH_RANGE = 10000000
+--disable_warnings
SET GLOBAL innodb_file_per_table = ON;
+SET GLOBAL innodb_file_format = `Barracuda`;
+--enable_warnings
create table t1 (a varchar(255)) engine=innodb encrypted=yes;
create table t2 (a varchar(255)) engine=innodb;
+show warnings;
create table t3 (a varchar(255)) engine=innodb encrypted=no;
-insert t1 values (repeat('foobar', 42));
-insert t2 values (repeat('temp', 42));
-insert t3 values (repeat('dummy', 42));
+insert t1 values (repeat('foobarsecret', 12));
+insert t2 values (repeat('tempsecret', 12));
+insert t3 values (repeat('dummysecret', 12));
--echo # Wait max 10 min for key encryption threads to encrypt all spaces
--let $wait_timeout= 600
@@ -34,19 +38,19 @@ SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_
--source include/shutdown_mysqld.inc
---let SEARCH_PATTERN=foobar
+--let SEARCH_PATTERN=foobarsecret
--echo # t1 yes on expecting NOT FOUND
-- let SEARCH_FILE=$t1_IBD
-- source include/search_pattern_in_file.inc
---let SEARCH_PATTERN=temp
+--let SEARCH_PATTERN=tempsecret
--echo # t2 ... on expecting NOT FOUND
-- let SEARCH_FILE=$t2_IBD
-- source include/search_pattern_in_file.inc
---let SEARCH_PATTERN=dummy
+--let SEARCH_PATTERN=dummysecret
--echo # t3 no on expecting FOUND
-- let SEARCH_FILE=$t3_IBD
-- source include/search_pattern_in_file.inc
---let SEARCH_PATTERN=foobar
+--let SEARCH_PATTERN=foobarsecret
--echo # ibdata1 expecting NOT FOUND
-- let SEARCH_FILE=$ib1_IBD
-- source include/search_pattern_in_file.inc
@@ -54,12 +58,12 @@ SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_
-- source include/start_mysqld.inc
--echo # Now turn off encryption and wait for threads to decrypt everything
-SET GLOBAL innodb_encryption_threads = 1;
+
SET GLOBAL innodb_encrypt_tables = off;
--echo # Wait max 10 min for key encryption threads to decrypt all spaces
--let $wait_timeout= 600
---let $wait_condition=SELECT COUNT(*) = 5 FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 AND KEY_ROTATION_PAGE_NUMBER IS NULL;
+--let $wait_condition=SELECT COUNT(*) = 5 FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 AND CURRENT_KEY_VERSION = 0;
--source include/wait_condition.inc
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
@@ -67,27 +71,27 @@ SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_
--source include/shutdown_mysqld.inc
---let SEARCH_PATTERN=foobar
+--let SEARCH_PATTERN=foobarsecret
--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 FOUND
+--let SEARCH_PATTERN=tempsecret
+--echo # t2 ... default expecting FOUND
-- let SEARCH_FILE=$t2_IBD
-- source include/search_pattern_in_file.inc
---let SEARCH_PATTERN=dummy
+--let SEARCH_PATTERN=dummysecret
--echo # t3 no on expecting FOUND
-- let SEARCH_FILE=$t3_IBD
-- source include/search_pattern_in_file.inc
---let SEARCH_PATTERN=foobar
+--let SEARCH_PATTERN=foobarsecret
--echo # ibdata1 expecting NOT FOUND
-- let SEARCH_FILE=$ib1_IBD
-- source include/search_pattern_in_file.inc
+
-- source include/start_mysqld.inc
--echo # Now turn on encryption and wait for threads to encrypt all spaces
-SET GLOBAL innodb_encryption_threads = 4;
SET GLOBAL innodb_encrypt_tables = on;
--echo # Wait max 10 min for key encryption threads to encrypt all spaces
@@ -100,19 +104,19 @@ SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_
--source include/shutdown_mysqld.inc
---let SEARCH_PATTERN=foobar
+--let SEARCH_PATTERN=foobarsecret
--echo # t1 yes on expecting NOT FOUND
-- let SEARCH_FILE=$t1_IBD
-- source include/search_pattern_in_file.inc
---let SEARCH_PATTERN=temp
+--let SEARCH_PATTERN=tempsecret
--echo # t2 ... on expecting NOT FOUND
-- let SEARCH_FILE=$t2_IBD
-- source include/search_pattern_in_file.inc
---let SEARCH_PATTERN=dummy
+--let SEARCH_PATTERN=dummysecret
--echo # t3 no on expecting FOUND
-- let SEARCH_FILE=$t3_IBD
-- source include/search_pattern_in_file.inc
---let SEARCH_PATTERN=foobar
+--let SEARCH_PATTERN=foobarsecret
--echo # ibdata1 expecting NOT FOUND
-- let SEARCH_FILE=$ib1_IBD
-- source include/search_pattern_in_file.inc
diff --git a/mysql-test/suite/encryption/t/encryption.innodb-bad-key-change2.test b/mysql-test/suite/encryption/t/encryption.innodb-bad-key-change2.test
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/mysql-test/suite/encryption/t/encryption.innodb-bad-key-change2.test
diff --git a/mysql-test/suite/encryption/t/filekeys_badtest.inc b/mysql-test/suite/encryption/t/filekeys_badtest.inc
index 60ac9f0e798..7c0858af20a 100644
--- a/mysql-test/suite/encryption/t/filekeys_badtest.inc
+++ b/mysql-test/suite/encryption/t/filekeys_badtest.inc
@@ -1,5 +1,5 @@
-- source include/not_embedded.inc
--- source include/have_innodb.inc
+-- source include/have_xtradb.inc
-- source filekeys_plugin.inc
--eval call mtr.add_suppression("$SEARCH_PATTERN")
@@ -7,6 +7,7 @@ call mtr.add_suppression("Plugin 'file_key_management' init function returned er
call mtr.add_suppression("Plugin 'file_key_management' registration.*failed");
--let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err
+--let SEARCH_RANGE= -10000
--source include/search_pattern_in_file.inc
--error ER_CANT_CREATE_TABLE
diff --git a/mysql-test/suite/encryption/t/filekeys_goodtest.inc b/mysql-test/suite/encryption/t/filekeys_goodtest.inc
index 12a79c13d2a..146a570412c 100644
--- a/mysql-test/suite/encryption/t/filekeys_goodtest.inc
+++ b/mysql-test/suite/encryption/t/filekeys_goodtest.inc
@@ -1,4 +1,4 @@
--- source include/have_innodb.inc
+-- source include/have_xtradb.inc
-- source filekeys_plugin.inc
create table t1(c1 bigint not null, b char(200)) engine=innodb encrypted=yes encryption_key_id=1;
diff --git a/mysql-test/suite/encryption/t/innochecksum.test b/mysql-test/suite/encryption/t/innochecksum.test
index 39e86d49674..a176cad6c0e 100644
--- a/mysql-test/suite/encryption/t/innochecksum.test
+++ b/mysql-test/suite/encryption/t/innochecksum.test
@@ -15,9 +15,12 @@ if (!$INNOCHECKSUM) {
--disable_query_log
let $innodb_compression_algorithm_orig=`SELECT @@innodb_compression_algorithm`;
-let MYSQLD_DATADIR= `SELECT @@datadir`;
+let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
+let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
--enable_query_log
+SET GLOBAL innodb_file_format = `Barracuda`;
+SET GLOBAL innodb_file_per_table = ON;
# zlib
set global innodb_compression_algorithm = 1;
@@ -93,4 +96,6 @@ DROP TABLE t1, t2, t3, t4, t5;
# reset system
--disable_query_log
EVAL SET GLOBAL innodb_compression_algorithm = $innodb_compression_algorithm_orig;
+EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig;
+EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig;
--enable_query_log
diff --git a/mysql-test/suite/encryption/t/innodb-bad-key-change.test b/mysql-test/suite/encryption/t/innodb-bad-key-change.test
index e8b5de99d80..66546872c25 100644
--- a/mysql-test/suite/encryption/t/innodb-bad-key-change.test
+++ b/mysql-test/suite/encryption/t/innodb-bad-key-change.test
@@ -2,26 +2,27 @@
-- source include/have_file_key_management_plugin.inc
# embedded does not support restart
-- source include/not_embedded.inc
--- source include/not_valgrind.inc
-# Avoid CrashReporter popup on Mac
--- source include/not_crashrep.inc
--- source include/not_windows.inc
#
# MDEV-8588: Assertion failure in file ha_innodb.cc line 21140 if at least one encrypted
# table exists and encryption service is not available.
#
-call mtr.add_suppression("Plugin 'file_key_management' init function returned error");
-call mtr.add_suppression("Plugin 'file_key_management' registration.*failed");
-call mtr.add_suppression("InnoDB: The page .* in file test/.* cannot be decrypted");
-call mtr.add_suppression("mysqld: File .* not found");
+call mtr.add_suppression("InnoDB: The page .*");
+call mtr.add_suppression("InnoDB: Cannot calculate statistics for table .* ");
+call mtr.add_suppression("Plugin 'file_key_management' .*");
+call mtr.add_suppression("mysqld: File .*");
--echo
--echo # Start server with keys2.txt
-- let $restart_parameters=--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys2.txt
-- source include/restart_mysqld.inc
+--disable_warnings
+SET GLOBAL innodb_file_format = `Barracuda`;
+SET GLOBAL innodb_file_per_table = ON;
+--enable_warnings
+
CREATE TABLE t1 (c VARCHAR(8)) ENGINE=InnoDB ENCRYPTED=YES ENCRYPTION_KEY_ID=2;
INSERT INTO t1 VALUES ('foobar');
ALTER TABLE t1 ADD COLUMN c2 INT;
@@ -41,14 +42,15 @@ SELECT * FROM t1;
--error ER_GET_ERRMSG
SELECT * FROM t1;
---replace_regex /tablespace [0-9]*/tablespace /
+--replace_regex /tablespace [0-9]*/tablespace / /key_id [0-9]*/key_id /
SHOW WARNINGS;
-- let $restart_parameters=--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keysbad3.txt
-- source include/restart_mysqld.inc
+
--replace_regex /tablespace [0-9]*/tablespace /
DROP TABLE t1;
---replace_regex /tablespace [0-9]*/tablespace /
+--replace_regex /tablespace [0-9]*/tablespace / /key_id [0-9]*/key_id /
SHOW WARNINGS;
#
@@ -56,10 +58,11 @@ SHOW WARNINGS;
# line 2856 on querying a table using wrong default encryption key
#
---echo # Start server with keys.txt
--- let $restart_parameters=--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys.txt
+--echo # Start server with keys3.txt
+-- let $restart_parameters=--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys3.txt
-- source include/restart_mysqld.inc
+SET GLOBAL innodb_default_encryption_key_id=5;
CREATE TABLE t2 (c VARCHAR(8), id int not null primary key, b int, key(b)) ENGINE=InnoDB ENCRYPTED=YES;
INSERT INTO t2 VALUES ('foobar',1,2);
@@ -70,58 +73,51 @@ INSERT INTO t2 VALUES ('foobar',1,2);
--error ER_GET_ERRMSG
SELECT * FROM t2;
---replace_regex /tablespace [0-9]*/tablespace /
+--replace_regex /tablespace [0-9]*/tablespace / /key_id [0-9]*/key_id /
SHOW WARNINGS;
--error ER_GET_ERRMSG
SELECT * FROM t2 where id = 1;
---replace_regex /tablespace [0-9]*/tablespace /
+--replace_regex /tablespace [0-9]*/tablespace / /key_id [0-9]*/key_id /
SHOW WARNINGS;
--error ER_GET_ERRMSG
SELECT * FROM t2 where b = 1;
---replace_regex /tablespace [0-9]*/tablespace /
+--replace_regex /tablespace [0-9]*/tablespace / /key_id [0-9]*/key_id /
SHOW WARNINGS;
+--replace_regex /tablespace [0-9]*/tablespace /
--error ER_GET_ERRMSG
INSERT INTO t2 VALUES ('tmp',3,3);
---replace_regex /tablespace [0-9]*/tablespace /
+--replace_regex /tablespace [0-9]*/tablespace / /key_id [0-9]*/key_id /
SHOW WARNINGS;
--error ER_GET_ERRMSG
DELETE FROM t2 where b = 3;
---replace_regex /tablespace [0-9]*/tablespace /
+--replace_regex /tablespace [0-9]*/tablespace / /key_id [0-9]*/key_id /
SHOW WARNINGS;
--error ER_GET_ERRMSG
DELETE FROM t2 where id = 3;
---replace_regex /tablespace [0-9]*/tablespace /
+--replace_regex /tablespace [0-9]*/tablespace / /key_id [0-9]*/key_id /
SHOW WARNINGS;
--error ER_GET_ERRMSG
UPDATE t2 set b = b +1;
---replace_regex /tablespace [0-9]*/tablespace /
+--replace_regex /tablespace [0-9]*/tablespace / /key_id [0-9]*/key_id /
SHOW WARNINGS;
OPTIMIZE TABLE t2;
---replace_regex /tablespace [0-9]*/tablespace /
+--replace_regex /tablespace [0-9]*/tablespace / /key_id [0-9]*/key_id /
SHOW WARNINGS;
--error ER_GET_ERRMSG
-ALTER TABLE t2 ADD COLUMN c INT;
---replace_regex /tablespace [0-9]*/tablespace /
+ALTER TABLE t2 ADD COLUMN d INT;
+--replace_regex /tablespace [0-9]*/tablespace / /key_id [0-9]*/key_id /
SHOW WARNINGS;
ANALYZE TABLE t2;
---replace_regex /tablespace [0-9]*/tablespace /
+--replace_regex /tablespace [0-9]*/tablespace / /key_id [0-9]*/key_id /
SHOW WARNINGS;
--error ER_GET_ERRMSG
TRUNCATE TABLE t2;
---replace_regex /tablespace [0-9]*/tablespace /
+--replace_regex /tablespace [0-9]*/tablespace / /key_id [0-9]*/key_id /
SHOW WARNINGS;
---replace_regex /.*tablespace [0-9]*//
---error ER_GET_ERRMSG
+
DROP TABLE t2;
---replace_regex /tablespace [0-9]*/tablespace /
-SHOW WARNINGS;
--echo
---echo # Restart server with keys.txt
--- let $restart_parameters=--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys.txt
+--echo # Start server with keys2.txt
+-- let $restart_parameters=--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys2.txt
-- source include/restart_mysqld.inc
-
---replace_regex /.*tablespace [0-9]*//
-DROP TABLE t2;
---replace_regex /tablespace [0-9]*/tablespace /
-SHOW WARNINGS;
diff --git a/mysql-test/suite/encryption/t/innodb-bad-key-change2.test b/mysql-test/suite/encryption/t/innodb-bad-key-change2.test
index c7c9e66dcf8..16155de4f31 100644
--- a/mysql-test/suite/encryption/t/innodb-bad-key-change2.test
+++ b/mysql-test/suite/encryption/t/innodb-bad-key-change2.test
@@ -1,49 +1,103 @@
--source include/have_innodb.inc
# embedded does not support restart
-- source include/not_embedded.inc
--- source include/not_valgrind.inc
-# Avoid CrashReporter popup on Mac
--- source include/not_crashrep.inc
-- source filekeys_plugin_exists.inc
#
# MDEV-8750: Server crashes in page_cur_is_after_last on altering table using a wrong encryption key
+# MDEV-8769: Server crash at file btr0btr.ic line 122 when defragmenting encrypted table using incorrect keys
+# MDEV-8768: Server crash at file btr0btr.ic line 122 when checking encrypted table using incorrect keys
+# MDEV-8727: Server/InnoDB hangs on shutdown after trying to read an encrypted table with a wrong key
#
-call mtr.add_suppression("InnoDB: The page .* in file test/t1 cannot be decrypted");
+call mtr.add_suppression("InnoDB: The page \[page id: space=[0-9]+, page number=[0-9]+\] in file test/t1new cannot be decrypted.");
+call mtr.add_suppression("InnoDB: The page \[page id: space=[0-9]+, page number=[0-9]+\] in file test/t1 cannot be decrypted.");
# Suppression for builds where file_key_management plugin is linked statically
-call mtr.add_suppression("Couldn't load plugins from 'file_key_management");
+call mtr.add_suppression("Couldn't load plugins from 'file_key_management.*");
+call mtr.add_suppression("InnoDB: Tablespace for table \`test\`.\`t1\` is set as discarded.");
---write_file $MYSQLTEST_VARDIR/keys1.txt
-1;770A8A65DA156D24EE2A093277530142
-4;770A8A65DA156D24EE2A093277530143
+--let $restart_parameters=--plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys2.txt
+--source include/restart_mysqld.inc
+
+--disable_warnings
+SET GLOBAL innodb_file_format = `Barracuda`;
+SET GLOBAL innodb_file_per_table = ON;
+--enable_warnings
+
+CREATE TABLE t1 (pk INT PRIMARY KEY, f VARCHAR(8)) ENGINE=InnoDB ENCRYPTED=YES ENCRYPTION_KEY_ID=4;
+INSERT INTO t1 VALUES (1,'foo'),(2,'bar');
+
+--let $restart_parameters=--plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys3.txt
+--source include/restart_mysqld.inc
+
+--error ER_GET_ERRMSG
+SELECT * FROM t1;
+--replace_regex /tablespace [0-9]*/tablespace / /key_id [0-9]*/key_id /
+SHOW WARNINGS;
+--error ER_GET_ERRMSG
+ALTER TABLE t1 engine=InnoDB;
+--replace_regex /tablespace [0-9]*/tablespace / /key_id [0-9]*/key_id /
+SHOW WARNINGS;
+
+OPTIMIZE TABLE t1;
+--replace_regex /tablespace [0-9]*/tablespace / /key_id [0-9]*/key_id /
+SHOW WARNINGS;
+
+CHECK TABLE t1;
+--replace_regex /tablespace [0-9]*/tablespace / /key_id [0-9]*/key_id /
+SHOW WARNINGS;
+
+--let $restart_parameters=--plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys2.txt
+--source include/restart_mysqld.inc
+
+let MYSQLD_DATADIR =`SELECT @@datadir`;
+let MYSQLD_TMPDIR = `SELECT @@tmpdir`;
+
+FLUSH TABLES t1 FOR EXPORT;
+perl;
+do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
+ib_backup_tablespaces("test", "t1");
EOF
+UNLOCK TABLES;
---let $restart_parameters= --innodb-encrypt-tables --innodb-stats-persistent --plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys1.txt
+--let $restart_parameters=--plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys3.txt
--source include/restart_mysqld.inc
-CREATE TABLE t1 (pk INT PRIMARY KEY, f VARCHAR(8)) ENGINE=InnoDB ENCRYPTION_KEY_ID=4;
-INSERT INTO t1 VALUES (1,'foo'),(2,'bar');
+# Discard should pass even with incorrect keys
+--replace_regex /tablespace [0-9]*/tablespace / /key_id [0-9]*/key_id /
+ALTER TABLE t1 DISCARD TABLESPACE;
---write_file $MYSQLTEST_VARDIR/keys2.txt
-1;770A8A65DA156D24EE2A093277530142
-4;770A8A65DA156D24EE2A093277530144
+perl;
+do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
+ib_discard_tablespaces("test", "t1");
+ib_restore_tablespaces("test", "t1");
EOF
---let $restart_parameters= --innodb-encrypt-tables --innodb-stats-persistent --plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys2.txt
+--let $restart_parameters=--plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys2.txt
--source include/restart_mysqld.inc
+ALTER TABLE t1 IMPORT TABLESPACE;
+SHOW CREATE TABLE t1;
+
+--let $restart_parameters=--plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys3.txt
+--source include/restart_mysqld.inc
+
+# Rename table should pass even with incorrect keys
+RENAME TABLE t1 TO t1new;
+
+# Alter table rename is not allowed with incorrect keys
+--replace_regex /tablespace [0-9]*/tablespace / /key_id [0-9]*/key_id /
--error ER_GET_ERRMSG
-select * from t1;
-show warnings;
---error ER_GET_ERRMSG
-alter table t1 discard tablespace;
-show warnings;
---error ER_GET_ERRMSG
-alter table t1 engine=InnoDB;
-show warnings;
+ALTER TABLE t1new RENAME TO t2new;
+
+# Drop should pass even with incorrect keys
+--replace_regex /tablespace [0-9]*/tablespace / /key_id [0-9]*/key_id /
+DROP TABLE t1new;
---let $restart_parameters= --innodb-encrypt-tables --innodb-stats-persistent --plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys1.txt
+#
+# Reset environment
+#
+--let $restart_parameters=
--source include/restart_mysqld.inc
-DROP TABLE t1;
---remove_file $MYSQLTEST_VARDIR/keys1.txt
---remove_file $MYSQLTEST_VARDIR/keys2.txt
+
+--error ER_BAD_TABLE_ERROR
+DROP TABLE t1, t1new;
diff --git a/mysql-test/suite/encryption/t/innodb-bad-key-change3.test b/mysql-test/suite/encryption/t/innodb-bad-key-change3.test
index dbd04748143..0ac0fc84906 100644
--- a/mysql-test/suite/encryption/t/innodb-bad-key-change3.test
+++ b/mysql-test/suite/encryption/t/innodb-bad-key-change3.test
@@ -9,8 +9,12 @@
# 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: 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.");
+call mtr.add_suppression("InnoDB: Tablespace for table \`test\`.\`t1\` is set as discarded.");
+
+--disable_query_log
+let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
+let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
+--enable_query_log
--let $MYSQLD_TMPDIR = `SELECT @@tmpdir`
--let $MYSQLD_DATADIR = `SELECT @@datadir`
@@ -29,7 +33,11 @@ EOF
--enable_reconnect
--source include/wait_until_connected_again.inc
+--disable_warnings
+SET GLOBAL innodb_file_format = `Barracuda`;
+SET GLOBAL innodb_file_per_table = ON;
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;
SHOW WARNINGS;
@@ -37,8 +45,6 @@ SHOW CREATE TABLE t1;
INSERT INTO t1 VALUES (1,'foobar'),(2,'barfoo');
let MYSQLD_DATADIR =`SELECT @@datadir`;
FLUSH TABLE t1 FOR EXPORT;
---echo # List before copying files
---list_files $MYSQLD_DATADIR/test
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_backup_tablespaces("test", "t1");
@@ -67,6 +73,11 @@ EOF
--source include/wait_until_connected_again.inc
--source include/restart_mysqld.inc
+--disable_warnings
+SET GLOBAL innodb_file_format = `Barracuda`;
+SET GLOBAL innodb_file_per_table = ON;
+--enable_warnings
+
--error ER_GET_ERRMSG
ALTER TABLE t1 IMPORT TABLESPACE;
SHOW CREATE TABLE t1;
@@ -95,6 +106,12 @@ EOF
DROP TABLE t1;
# reset system
+--disable_warnings
+--disable_query_log
+EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig;
+EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig;
+--enable_query_log
+--enable_warnings
--remove_file $MYSQLTEST_VARDIR/keys1.txt
--remove_file $MYSQLTEST_VARDIR/keys2.txt
diff --git a/mysql-test/suite/encryption/t/innodb-bad-key-change5.opt b/mysql-test/suite/encryption/t/innodb-bad-key-change4.opt
index 6426bac41a0..6426bac41a0 100644
--- a/mysql-test/suite/encryption/t/innodb-bad-key-change5.opt
+++ b/mysql-test/suite/encryption/t/innodb-bad-key-change4.opt
diff --git a/mysql-test/suite/encryption/t/innodb-bad-key-change4.test b/mysql-test/suite/encryption/t/innodb-bad-key-change4.test
index 0459c433ece..14d88614f55 100644
--- a/mysql-test/suite/encryption/t/innodb-bad-key-change4.test
+++ b/mysql-test/suite/encryption/t/innodb-bad-key-change4.test
@@ -1,43 +1,43 @@
--source include/have_innodb.inc
# embedded does not support restart
-- source include/not_embedded.inc
--- source include/not_valgrind.inc
-# Avoid CrashReporter popup on Mac
--- source include/not_crashrep.inc
-- source filekeys_plugin_exists.inc
#
+# MDEV-8769: Server crash at file btr0btr.ic line 122 when defragmenting encrypted table using incorrect keys
# MDEV-8768: Server crash at file btr0btr.ic line 122 when checking encrypted table using incorrect keys
#
-call mtr.add_suppression("InnoDB: The page .* in file test/t1 cannot be decrypted");
-# Suppression for builds where file_key_management plugin is linked statically
-call mtr.add_suppression("Couldn't load plugins from 'file_key_management");
---write_file $MYSQLTEST_VARDIR/keys1.txt
-1;770A8A65DA156D24EE2A093277530142
-4;770A8A65DA156D24EE2A093277530143
-EOF
+call mtr.add_suppression("InnoDB: The page \[page id: space=[0-9]+, page number=[0-9]+\] in file test/t1 cannot be decrypted.");
+call mtr.add_suppression("InnoDB: Cannot open table .*");
+call mtr.add_suppression("InnoDB: .ibd file is missing for table test/.*");
+# Suppression for builds where file_key_management plugin is linked statically
+call mtr.add_suppression("Couldn't load plugins from 'file_key_management.*");
---let $restart_parameters= --innodb-encrypt-tables --innodb-stats-persistent --plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys1.txt
+--let $restart_parameters=--plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys2.txt
--source include/restart_mysqld.inc
-CREATE TABLE t1 (pk INT PRIMARY KEY, f VARCHAR(8)) ENGINE=InnoDB ENCRYPTION_KEY_ID=4;
-INSERT INTO t1 VALUES (1,'foo'),(2,'bar');
+--disable_warnings
+SET GLOBAL innodb_file_format = `Barracuda`;
+SET GLOBAL innodb_file_per_table = ON;
+--enable_warnings
---write_file $MYSQLTEST_VARDIR/keys2.txt
-1;770A8A65DA156D24EE2A093277530142
-4;770A8A65DA156D24EE2A093277530144
-EOF
+CREATE TABLE t1 (pk INT PRIMARY KEY, f VARCHAR(8)) ENGINE=InnoDB ENCRYPTED=YES ENCRYPTION_KEY_ID=4;
+INSERT INTO t1 VALUES (1,'foo'),(2,'bar');
---let $restart_parameters= --innodb-encrypt-tables --innodb-stats-persistent --plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys2.txt
+--let $restart_parameters=--plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys3.txt
--source include/restart_mysqld.inc
---replace_regex /tablespace [0-9]*/tablespace #/
+--replace_regex /tablespace [0-9]*/tablespace / /key_id [0-9]*/key_id /
+OPTIMIZE TABLE t1;
+--replace_regex /tablespace [0-9]*/tablespace / /key_id [0-9]*/key_id /
+SHOW WARNINGS;
+
+--replace_regex /tablespace [0-9]*/tablespace / /key_id [0-9]*/key_id /
CHECK TABLE t1;
+--replace_regex /tablespace [0-9]*/tablespace / /key_id [0-9]*/key_id /
SHOW WARNINGS;
---let $restart_parameters= --innodb-encrypt-tables --innodb-stats-persistent --plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys1.txt
+--let $restart_parameters=--plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys2.txt
--source include/restart_mysqld.inc
DROP TABLE t1;
---remove_file $MYSQLTEST_VARDIR/keys1.txt
---remove_file $MYSQLTEST_VARDIR/keys2.txt
diff --git a/mysql-test/suite/encryption/t/innodb-bad-key-change5.test b/mysql-test/suite/encryption/t/innodb-bad-key-change5.test
deleted file mode 100644
index b205d203374..00000000000
--- a/mysql-test/suite/encryption/t/innodb-bad-key-change5.test
+++ /dev/null
@@ -1,42 +0,0 @@
---source include/have_innodb.inc
-# embedded does not support restart
--- source include/not_embedded.inc
--- source include/not_valgrind.inc
-# Avoid CrashReporter popup on Mac
--- source include/not_crashrep.inc
--- source filekeys_plugin_exists.inc
-#
-# MDEV-8769: Server crash at file btr0btr.ic line 122 when defragmenting encrypted table using incorrect keys
-#
-call mtr.add_suppression("InnoDB: The page .* in file test/t1 cannot be decrypted");
-# Suppression for builds where file_key_management plugin is linked statically
-call mtr.add_suppression("Couldn't load plugins from 'file_key_management");
-
---write_file $MYSQLTEST_VARDIR/keys1.txt
-1;770A8A65DA156D24EE2A093277530142
-4;770A8A65DA156D24EE2A093277530143
-EOF
-
---let $restart_parameters= --innodb-encrypt-tables --innodb-defragment=1 --innodb-stats-persistent --plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys1.txt
---source include/restart_mysqld.inc
-
-CREATE TABLE t1 (pk INT PRIMARY KEY, f VARCHAR(8)) ENGINE=InnoDB ENCRYPTION_KEY_ID=4;
-INSERT INTO t1 VALUES (1,'foo'),(2,'bar');
-
---write_file $MYSQLTEST_VARDIR/keys2.txt
-1;770A8A65DA156D24EE2A093277530142
-4;770A8A65DA156D24EE2A093277530144
-EOF
-
---let $restart_parameters= --innodb-encrypt-tables --innodb-defragment=1 --innodb-stats-persistent --plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys2.txt
---source include/restart_mysqld.inc
-
-OPTIMIZE TABLE t1;
-SHOW WARNINGS;
-
---let $restart_parameters= --innodb-encrypt-tables --innodb-defragment=1 --innodb-stats-persistent --plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys1.txt
---source include/restart_mysqld.inc
-
-DROP TABLE t1;
---remove_file $MYSQLTEST_VARDIR/keys1.txt
---remove_file $MYSQLTEST_VARDIR/keys2.txt
diff --git a/mysql-test/suite/encryption/t/innodb-bad-key-shutdown.test b/mysql-test/suite/encryption/t/innodb-bad-key-shutdown.test
deleted file mode 100644
index d1b009fad93..00000000000
--- a/mysql-test/suite/encryption/t/innodb-bad-key-shutdown.test
+++ /dev/null
@@ -1,52 +0,0 @@
-#
-# MDEV-8727: Server/InnoDB hangs on shutdown after trying to read an encrypted table with a wrong key
-#
-
---source include/have_innodb.inc
---source include/not_embedded.inc
-
-call mtr.add_suppression("InnoDB: The page .* in file test/t1 cannot be decrypted");
-# Suppression for builds where file_key_management plugin is linked statically
-call mtr.add_suppression("Couldn't load plugins from 'file_key_management");
-
---echo #
---echo # Restart the server with key 4 in the key file
---echo #
-
---write_file $MYSQLTEST_VARDIR/keys1.txt
-1;770A8A65DA156D24EE2A093277530142
-4;18420B5CBA31CCDFFE9716E91EB61374D05914F3ADE23E03
-EOF
-
---let $restart_parameters= --plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys1.txt
---source include/restart_mysqld.inc
-
-CREATE TABLE t1 (i INT, KEY(i)) ENGINE=InnoDB ENCRYPTED=YES ENCRYPTION_KEY_ID=4;
-INSERT INTO t1 VALUES (1);
-
---echo #
---echo # Restart the server with a different value for key 4 in the key file
---echo #
-
---write_file $MYSQLTEST_VARDIR/keys2.txt
-1;770A8A65DA156D24EE2A093277530142
-4;22222222222222222222222222222222
-EOF
-
---let $restart_parameters= --plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys2.txt
---source include/restart_mysqld.inc
-
---error ER_GET_ERRMSG
-SELECT * FROM t1;
-
---let $restart_parameters= --plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys1.txt
---source include/restart_mysqld.inc
-
-SELECT * FROM t1;
-DROP TABLE t1;
-
---let $restart_parameters=
---source include/restart_mysqld.inc
-
---remove_file $MYSQLTEST_VARDIR/keys2.txt
---remove_file $MYSQLTEST_VARDIR/keys1.txt
diff --git a/mysql-test/suite/encryption/t/innodb-compressed-blob.opt b/mysql-test/suite/encryption/t/innodb-compressed-blob.opt
new file mode 100644
index 00000000000..36dcb6c6f26
--- /dev/null
+++ b/mysql-test/suite/encryption/t/innodb-compressed-blob.opt
@@ -0,0 +1,4 @@
+--innodb-tablespaces-encryption
+--innodb-encrypt-tables=on
+--innodb-encryption-threads=2
+--max_allowed_packet=64K
diff --git a/mysql-test/suite/encryption/t/innodb-compressed-blob.test b/mysql-test/suite/encryption/t/innodb-compressed-blob.test
new file mode 100644
index 00000000000..4024c8fa641
--- /dev/null
+++ b/mysql-test/suite/encryption/t/innodb-compressed-blob.test
@@ -0,0 +1,45 @@
+-- source include/have_innodb.inc
+-- source include/have_file_key_management_plugin.inc
+
+# embedded does not support restart
+-- source include/not_embedded.inc
+
+call mtr.add_suppression("InnoDB: However key management plugin or used key_version .*");
+call mtr.add_suppression("InnoDB: The page \[page id: space=[0-9]+, page number=[0-9]+\] in file test/t1 cannot be decrypted.");
+call mtr.add_suppression("InnoDB: The page \[page id: space=[0-9]+, page number=[0-9]+\] in file test/t2 cannot be decrypted.");
+call mtr.add_suppression("InnoDB: The page \[page id: space=[0-9]+, page number=[0-9]+\] in file test/t3 cannot be decrypted.");
+
+
+--echo # Restart mysqld --file-key-management-filename=keys2.txt
+-- let $restart_parameters=--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys2.txt
+-- source include/restart_mysqld.inc
+
+--disable_warnings
+SET GLOBAL innodb_file_format = `Barracuda`;
+SET GLOBAL innodb_file_per_table = ON;
+--enable_warnings
+
+set GLOBAL innodb_default_encryption_key_id=4;
+create table t1(a int not null primary key, b blob, index(b(10))) engine=innodb row_format=compressed;
+create table t2(a int not null primary key, b blob, index(b(10))) engine=innodb row_format=compressed encrypted=yes;
+create table t3(a int not null primary key, b blob, index(b(10))) engine=innodb row_format=compressed encrypted=no;
+
+insert into t1 values (1, repeat('secret',6000));
+insert into t2 values (1, repeat('secret',6000));
+insert into t3 values (1, repeat('secret',6000));
+
+--echo # Restart mysqld --file-key-management-filename=keys3.txt
+-- let $restart_parameters=--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys3.txt
+-- source include/restart_mysqld.inc
+
+--error 1296
+select count(*) from t1 FORCE INDEX (b) where b like 'secret%';
+--error 1296
+select count(*) from t2 FORCE INDEX (b) where b like 'secret%';
+select count(*) from t3 FORCE INDEX (b) where b like 'secret%';
+
+--echo # Restart mysqld --file-key-management-filename=keys2.txt
+-- let $restart_parameters=--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys2.txt
+-- source include/restart_mysqld.inc
+
+drop table t1,t2,t3;
diff --git a/mysql-test/suite/encryption/t/innodb-discard-import-change.test b/mysql-test/suite/encryption/t/innodb-discard-import-change.test
index 2cb6865ed95..a278a8fba29 100644
--- a/mysql-test/suite/encryption/t/innodb-discard-import-change.test
+++ b/mysql-test/suite/encryption/t/innodb-discard-import-change.test
@@ -6,9 +6,17 @@
call mtr.add_suppression("InnoDB: Table .* tablespace is set as discarded");
+--disable_query_log
+let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
+let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
let $innodb_compression_algo = `SELECT @@innodb_compression_algorithm`;
+--enable_query_log
+--disable_warnings
+SET GLOBAL innodb_file_format = `Barracuda`;
+SET GLOBAL innodb_file_per_table = ON;
SET GLOBAL innodb_compression_algorithm = 1;
+--enable_warnings
create table t1(c1 bigint not null primary key auto_increment, b char(200)) engine=innodb encrypted=yes encryption_key_id=4;
create table t2(c1 bigint not null primary key auto_increment, b char(200)) engine=innodb encrypted=yes encryption_key_id=1;
@@ -113,6 +121,11 @@ SELECT COUNT(*) FROM t5;
DROP TABLE t1,t2,t3,t4,t5,t6;
# reset system
+--disable_warnings
--disable_query_log
+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_compression_algorithm = $innodb_compression_algo;
--enable_query_log
+--enable_warnings
+
diff --git a/mysql-test/suite/encryption/t/innodb-discard-import.test b/mysql-test/suite/encryption/t/innodb-discard-import.test
index e105cf82b67..9feaacc41e5 100644
--- a/mysql-test/suite/encryption/t/innodb-discard-import.test
+++ b/mysql-test/suite/encryption/t/innodb-discard-import.test
@@ -13,8 +13,17 @@
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
+let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
+let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
let $innodb_compression_algo = `SELECT @@innodb_compression_algorithm`;
+--enable_query_log
+
+--disable_warnings
+SET GLOBAL innodb_file_format = `Barracuda`;
+SET GLOBAL innodb_file_per_table = ON;
SET GLOBAL innodb_compression_algorithm = 1;
+--enable_warnings
--let $MYSQLD_TMPDIR = `SELECT @@tmpdir`
--let $MYSQLD_DATADIR = `SELECT @@datadir`
@@ -117,6 +126,10 @@ DROP PROCEDURE innodb_insert_proc;
DROP TABLE t1,t2,t3,t4;
# reset system
+--disable_warnings
--disable_query_log
+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_compression_algorithm = $innodb_compression_algo;
--enable_query_log
+--enable_warnings
diff --git a/mysql-test/suite/encryption/t/innodb-encryption-alter.test b/mysql-test/suite/encryption/t/innodb-encryption-alter.test
index cb7d5a47975..316ece1c16b 100644
--- a/mysql-test/suite/encryption/t/innodb-encryption-alter.test
+++ b/mysql-test/suite/encryption/t/innodb-encryption-alter.test
@@ -5,9 +5,15 @@
# MDEV-8817: Failing assertion: new_state->key_version != ENCRYPTION_KEY_VERSION_INVALID
#
+--disable_query_log
+let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
+let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
let $encrypt_tables = `SELECT @@innodb_encrypt_tables`;
let $threads = `SELECT @@innodb_encryption_threads`;
+--enable_query_log
+SET GLOBAL innodb_file_format = `Barracuda`;
+SET GLOBAL innodb_file_per_table = ON;
SET GLOBAL innodb_encrypt_tables = ON;
SET GLOBAL innodb_encryption_threads = 4;
@@ -85,6 +91,8 @@ drop table t1,t2;
# reset system
--disable_query_log
+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_encrypt_tables = $encrypt_tables;
EVAL SET GLOBAL innodb_encryption_threads = $threads;
--enable_query_log
diff --git a/mysql-test/suite/encryption/t/innodb-encryption-disable.test b/mysql-test/suite/encryption/t/innodb-encryption-disable.test
index fed9878ffbc..38f36076c73 100644
--- a/mysql-test/suite/encryption/t/innodb-encryption-disable.test
+++ b/mysql-test/suite/encryption/t/innodb-encryption-disable.test
@@ -1,22 +1,19 @@
-- source include/have_innodb.inc
# embedded does not support restart
-- source include/not_embedded.inc
--- source include/not_valgrind.inc
-# Avoid CrashReporter popup on Mac
--- source include/not_crashrep.inc
-- source filekeys_plugin_exists.inc
#
# MDEV-9559: Server without encryption configs crashes if selecting from an implicitly encrypted table
#
-call mtr.add_suppression("InnoDB: The page .* in file test/t[15] cannot be decrypted");
-call mtr.add_suppression("Couldn't load plugins from 'file_key_management");
---write_file $MYSQLTEST_VARDIR/keys1.txt
-1;770A8A65DA156D24EE2A093277530142
-EOF
+call mtr.add_suppression("InnoDB: The page \[page id: space=[0-9]+, page number=[0-9]+\] in file test/t1 cannot be decrypted.");
+call mtr.add_suppression("InnoDB: The page \[page id: space=[0-9]+, page number=[0-9]+\] in file test/t5 cannot be decrypted.");
---let $restart_parameters= --innodb-encrypt-tables --plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys1.txt
+# Suppression for builds where file_key_management plugin is linked statically
+call mtr.add_suppression("Couldn't load plugins from 'file_key_management*");
+
+--let $restart_parameters=--innodb-encrypt-tables=ON --plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys2.txt
--source include/restart_mysqld.inc
create table t5 (
@@ -38,27 +35,18 @@ CREATE TABLE `t1` (
) ENGINE=InnoDB;
insert into t1 values (1,2,'maria','db','encryption');
-
-select * from t1;
-select * from t5;
-
alter table t1 encrypted='yes' `encryption_key_id`=1;
-select * from t1;
-select * from t5;
-
---let $restart_parameters= --innodb-encrypt-tables=OFF
+--let $restart_parameters=--innodb-encrypt-tables=OFF
--source include/restart_mysqld.inc
---error ER_GET_ERRMSG
+--error 1296
select * from t1;
---error ER_GET_ERRMSG
+--error 1296
select * from t5;
---let $restart_parameters= --innodb-encrypt-tables --plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys1.txt
+--let $restart_parameters=--innodb-encrypt-tables=ON --plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys2.txt
--source include/restart_mysqld.inc
drop table t1;
drop table t5;
-
---remove_file $MYSQLTEST_VARDIR/keys1.txt
diff --git a/mysql-test/suite/encryption/t/innodb-force-corrupt.test b/mysql-test/suite/encryption/t/innodb-force-corrupt.test
new file mode 100644
index 00000000000..dd4ee51b1eb
--- /dev/null
+++ b/mysql-test/suite/encryption/t/innodb-force-corrupt.test
@@ -0,0 +1,92 @@
+#
+# MDEV-11759: Encryption code in MariaDB 10.1/10.2 causes compatibility problems
+#
+
+-- source include/have_innodb.inc
+-- source include/have_file_key_management_plugin.inc
+# Don't test under embedded
+-- source include/not_embedded.inc
+
+CALL mtr.add_suppression("InnoDB: Database page corruption on disk or a failed .*");
+CALL mtr.add_suppression("InnoDB: Corruption: Block in space_id .*");
+CALL mtr.add_suppression("InnoDB: However key management plugin or used key_version .*");
+call mtr.add_suppression("InnoDB: The page \[page id: space=[0-9]+, page number=[0-9]+\] in file test/t1 cannot be decrypted.");
+call mtr.add_suppression("InnoDB: The page \[page id: space=[0-9]+, page number=[0-9]+\] in file test/t2 cannot be decrypted.");
+call mtr.add_suppression("InnoDB: The page \[page id: space=[0-9]+, page number=[0-9]+\] in file test/t3 cannot be decrypted.");
+
+--disable_warnings
+SET GLOBAL innodb_file_format = `Barracuda`;
+SET GLOBAL innodb_file_per_table = ON;
+set global innodb_compression_algorithm = 1;
+--enable_warnings
+
+--echo # Create and populate tables to be corrupted
+CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT,c char(200)) ENGINE=InnoDB encrypted=yes;
+CREATE TABLE t2 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT,c char(200)) ENGINE=InnoDB row_format=compressed encrypted=yes;
+CREATE TABLE t3 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT, c char(200)) ENGINE=InnoDB page_compressed=yes encrypted=yes;
+
+BEGIN;
+INSERT INTO t1 (b,c) VALUES ('corrupt me','secret');
+--disable_query_log
+--let $i = 100
+while ($i)
+{
+ INSERT INTO t1 (b,c) VALUES (REPEAT('abcabcabc', 100),'secretsecret');
+ dec $i;
+}
+--enable_query_log
+
+INSERT INTO t1 (b,c) VALUES ('corrupt me','moresecretmoresecret');
+INSERT INTO t2 select * from t1;
+INSERT INTO t3 select * from t1;
+COMMIT;
+
+let INNODB_PAGE_SIZE=`select @@innodb_page_size`;
+let MYSQLD_DATADIR=`select @@datadir`;
+
+--source include/shutdown_mysqld.inc
+
+--echo # Backup tables before corrupting
+--copy_file $MYSQLD_DATADIR/test/t1.ibd $MYSQLD_DATADIR/test/t1.ibd.backup
+--copy_file $MYSQLD_DATADIR/test/t2.ibd $MYSQLD_DATADIR/test/t2.ibd.backup
+--copy_file $MYSQLD_DATADIR/test/t3.ibd $MYSQLD_DATADIR/test/t3.ibd.backup
+
+--echo # Corrupt tables
+
+perl;
+open(FILE, "+<", "$ENV{MYSQLD_DATADIR}/test/t1.ibd") or die "open";
+binmode FILE;
+seek(FILE, $ENV{'INNODB_PAGE_SIZE'} * 3 + 26, SEEK_SET) or die "seek";
+print FILE pack("H*", "c00lcafedeadb017");
+close FILE or die "close";
+open(FILE, "+<", "$ENV{MYSQLD_DATADIR}/test/t2.ibd") or die "open";
+binmode FILE;
+seek(FILE, $ENV{'INNODB_PAGE_SIZE'} * 3 + 26, SEEK_SET) or die "seek";
+print FILE pack("H*", "c00lcafedeadb017");
+close FILE or die "close";
+open(FILE, "+<", "$ENV{MYSQLD_DATADIR}/test/t3.ibd") or die "open";
+binmode FILE;
+seek(FILE, $ENV{'INNODB_PAGE_SIZE'} * 3 + 26, SEEK_SET) or die "seek";
+print FILE pack("H*", "c00lcafedeadb017");
+close FILE or die "close";
+EOF
+
+--source include/start_mysqld.inc
+
+--error ER_GET_ERRMSG
+SELECT * FROM t1;
+--error ER_GET_ERRMSG
+SELECT * FROM t2;
+--error ER_GET_ERRMSG
+SELECT * FROM t3;
+
+--source include/shutdown_mysqld.inc
+
+--echo # Restore the original tables
+--move_file $MYSQLD_DATADIR/test/t1.ibd.backup $MYSQLD_DATADIR/test/t1.ibd
+--move_file $MYSQLD_DATADIR/test/t2.ibd.backup $MYSQLD_DATADIR/test/t2.ibd
+--move_file $MYSQLD_DATADIR/test/t3.ibd.backup $MYSQLD_DATADIR/test/t3.ibd
+
+--source include/start_mysqld.inc
+
+DROP TABLE t1,t2,t3;
diff --git a/mysql-test/suite/encryption/t/innodb-log-encrypt-crash.opt b/mysql-test/suite/encryption/t/innodb-log-encrypt-crash.opt
new file mode 100644
index 00000000000..e76aa060879
--- /dev/null
+++ b/mysql-test/suite/encryption/t/innodb-log-encrypt-crash.opt
@@ -0,0 +1,6 @@
+--innodb-encrypt-log=ON
+--plugin-load-add=$FILE_KEY_MANAGEMENT_SO
+--loose-file-key-management
+--loose-file-key-management-filename=$MYSQL_TEST_DIR/std_data/logkey.txt
+--file-key-management-encryption-algorithm=aes_cbc
+--innodb-buffer-pool-size=128M
diff --git a/mysql-test/suite/encryption/t/innodb-log-encrypt-crash.test b/mysql-test/suite/encryption/t/innodb-log-encrypt-crash.test
new file mode 100644
index 00000000000..cb9a69d036b
--- /dev/null
+++ b/mysql-test/suite/encryption/t/innodb-log-encrypt-crash.test
@@ -0,0 +1,41 @@
+-- source include/have_innodb.inc
+-- source include/not_embedded.inc
+# test takes very long time on debug build
+-- source include/not_debug.inc
+-- source include/big_test.inc
+-- source filekeys_plugin.inc
+
+call mtr.add_suppression("InnoDB: New log files created, LSN=.*");
+call mtr.add_suppression("InnoDB: Creating foreign key constraint system tables.");
+call mtr.add_suppression("InnoDB: Error: Table .*");
+
+#
+# MDEV-9422: Checksum errors on restart when killing busy instance that uses encrypted XtraDB tables
+#
+
+CREATE TABLE t1 (
+ pk bigint auto_increment,
+ col_int int,
+ col_int_key int,
+ col_char char(12),
+ col_char_key char(12),
+ primary key (pk),
+ key (`col_int_key` ),
+ key (`col_char_key` )
+) ENGINE=InnoDB;
+CREATE TABLE t2 LIKE t1;
+
+INSERT INTO t1 VALUES (NULL,1,1,'foo','foo'),(NULL,2,2,'bar','bar'),(NULL,3,3,'baz','baz'),(NULL,4,4,'qux','qux');
+INSERT INTO t2
+ SELECT NULL, a1.col_int, a1.col_int_key, a1.col_char, a1.col_char_key
+ FROM t1 a1, t1 a2, t1 a3, t1 a4, t1 a5, t1 a6, t1 a7, t1 a8, t1 a9, t1 a10;
+
+--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+--shutdown_server 0
+--source include/wait_until_disconnected.inc
+
+--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+--enable_reconnect
+--source include/wait_until_connected_again.inc
+
+DROP TABLE t1, t2;
diff --git a/mysql-test/suite/encryption/t/innodb-log-encrypt.opt b/mysql-test/suite/encryption/t/innodb-log-encrypt.opt
new file mode 100644
index 00000000000..24046fe779a
--- /dev/null
+++ b/mysql-test/suite/encryption/t/innodb-log-encrypt.opt
@@ -0,0 +1,6 @@
+--innodb-encrypt-log=ON
+--innodb-encrypt-tables=FORCE
+--plugin-load-add=$FILE_KEY_MANAGEMENT_SO
+--loose-file-key-management
+--loose-file-key-management-filename=$MYSQL_TEST_DIR/std_data/logkey.txt
+--file-key-management-encryption-algorithm=aes_cbc
diff --git a/mysql-test/suite/encryption/t/innodb-log-encrypt.test b/mysql-test/suite/encryption/t/innodb-log-encrypt.test
new file mode 100644
index 00000000000..0555f9d49aa
--- /dev/null
+++ b/mysql-test/suite/encryption/t/innodb-log-encrypt.test
@@ -0,0 +1,97 @@
+-- source include/have_innodb.inc
+-- source include/not_embedded.inc
+-- source filekeys_plugin.inc
+
+#
+# MDEV-9011: Redo log encryption does not work
+#
+
+SET GLOBAL innodb_file_format = `Barracuda`;
+SET GLOBAL innodb_file_per_table = ON;
+
+create table t1(c1 bigint not null, b char(200), c varchar(200)) engine=innodb encrypted=yes encryption_key_id=1;
+show warnings;
+
+delimiter //;
+create procedure innodb_insert_proc (repeat_count int)
+begin
+ declare current_num int;
+ set current_num = 0;
+ while current_num < repeat_count do
+ insert into t1 values(current_num, substring(MD5(RAND()), -64), REPEAT('privatejanprivate',10));
+ set current_num = current_num + 1;
+ end while;
+end//
+delimiter ;//
+commit;
+
+begin;
+call innodb_insert_proc(2000);
+commit;
+
+update t1 set c1 = c1 +1;
+select count(*) from t1;
+
+--let $MYSQLD_DATADIR=`select @@datadir`
+--let ib1_IBD = $MYSQLD_DATADIR/ibdata1
+--let t1_IBD = $MYSQLD_DATADIR/test/t1.ibd
+--let log0 = $MYSQLD_DATADIR/ib_logfile0
+--let log1 = $MYSQLD_DATADIR/ib_logfile1
+--let SEARCH_RANGE = 10000000
+--let SEARCH_PATTERN=privatejanprivate
+
+-- source include/kill_mysqld.inc
+
+--echo # ibdata1 yes on expecting NOT FOUND
+-- let SEARCH_FILE=$ib1_IBD
+-- source include/search_pattern_in_file.inc
+--echo # t1 yes on expecting NOT FOUND
+-- let SEARCH_FILE=$t1_IBD
+-- source include/search_pattern_in_file.inc
+--echo # log0 yes on expecting NOT FOUND
+-- let SEARCH_FILE=$log0
+-- source include/search_pattern_in_file.inc
+--echo # log1 yes on expecting NOT FOUND
+-- let SEARCH_FILE=$log1
+-- source include/search_pattern_in_file.inc
+
+--echo # Restart mysqld --innodb_encrypt_log=0
+-- let $restart_parameters=--innodb_encrypt_log=0
+-- source include/start_mysqld.inc
+
+insert into t1 values(5000, substring(MD5(RAND()), -64), REPEAT('publicmessage',10));
+insert into t1 values(5001, substring(MD5(RAND()), -64), REPEAT('publicmessage',10));
+insert into t1 values(5002, substring(MD5(RAND()), -64), REPEAT('publicmessage',10));
+insert into t1 values(5003, substring(MD5(RAND()), -64), REPEAT('publicmessage',10));
+insert into t1 values(5004, substring(MD5(RAND()), -64), REPEAT('publicmessage',10));
+
+--let SEARCH_PATTERN=privatejanprivate
+--echo # ibdata1 yes on expecting NOT FOUND
+-- let SEARCH_FILE=$ib1_IBD
+-- source include/search_pattern_in_file.inc
+--echo # t1 yes on expecting NOT FOUND
+-- let SEARCH_FILE=$t1_IBD
+-- source include/search_pattern_in_file.inc
+--echo # log0 yes on expecting NOT FOUND
+-- let SEARCH_FILE=$log0
+-- source include/search_pattern_in_file.inc
+--echo # log1 yes on expecting NOT FOUND
+-- let SEARCH_FILE=$log1
+-- source include/search_pattern_in_file.inc
+
+--let SEARCH_PATTERN=publicmessage
+--echo # ibdata1 yes on expecting NOT FOUND
+-- let SEARCH_FILE=$ib1_IBD
+-- source include/search_pattern_in_file.inc
+--echo # t1 yes on expecting NOT FOUND
+-- let SEARCH_FILE=$t1_IBD
+-- source include/search_pattern_in_file.inc
+--echo # log0 no on expecting FOUND/NOTFOUND depending where insert goes
+-- let SEARCH_FILE=$log0
+-- source include/search_pattern_in_file.inc
+--echo # log1 no on expecting FOUND/NOTFOUND depending where insert goes
+-- let SEARCH_FILE=$log1
+-- source include/search_pattern_in_file.inc
+
+drop procedure innodb_insert_proc;
+drop table t1;
diff --git a/mysql-test/suite/encryption/t/innodb-missing-key.test b/mysql-test/suite/encryption/t/innodb-missing-key.test
index 84ca92010e9..07a2b16211c 100644
--- a/mysql-test/suite/encryption/t/innodb-missing-key.test
+++ b/mysql-test/suite/encryption/t/innodb-missing-key.test
@@ -6,7 +6,10 @@
#
# MDEV-11004: Unable to start (Segfault or os error 2) when encryption key missing
#
-call mtr.add_suppression("InnoDB: The page .* in file test/t. cannot be decrypted");
+
+call mtr.add_suppression("InnoDB: The page \[page id: space=[0-9]+, page number=[0-9]+\] in file test/t1 cannot be decrypted.");
+call mtr.add_suppression("InnoDB: The page \[page id: space=[0-9]+, page number=[0-9]+\] in file test/t2 cannot be decrypted.");
+call mtr.add_suppression("InnoDB: The page \[page id: space=[0-9]+, page number=[0-9]+\] in file test/t3 cannot be decrypted.");
--echo
--echo # Start server with keys2.txt
diff --git a/mysql-test/suite/encryption/t/innodb-page_encryption-32k.test b/mysql-test/suite/encryption/t/innodb-page_encryption-32k.test
index 03c9c93ff06..325f0a86521 100644
--- a/mysql-test/suite/encryption/t/innodb-page_encryption-32k.test
+++ b/mysql-test/suite/encryption/t/innodb-page_encryption-32k.test
@@ -5,12 +5,20 @@
--source include/have_innodb_32k.inc
--source include/have_file_key_management_plugin.inc
+call mtr.add_suppression("InnoDB: Warning: innodb_page_size has been changed from default value *");
+
+--disable_query_log
+# These values can change during the test
+let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
+let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
+--enable_query_log
+
+SET GLOBAL innodb_file_format = `Barracuda`;
+SET GLOBAL innodb_file_per_table = ON;
+
create table innodb_normal(c1 bigint not null, b char(200)) engine=innodb;
create table innodb_compact(c1 bigint not null, b char(200)) engine=innodb row_format=compact encrypted=yes encryption_key_id=1;
---error ER_CANT_CREATE_TABLE
create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic encrypted=yes encryption_key_id=3;
-show warnings;
-create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic encrypted=yes encryption_key_id=33;
create table innodb_redundant(c1 bigint not null, b char(200)) engine=innodb row_format=redundant encrypted=yes encryption_key_id=4;
show create table innodb_compact;
@@ -80,3 +88,9 @@ drop table innodb_normal;
drop table innodb_compact;
drop table innodb_dynamic;
drop table innodb_redundant;
+
+# reset system
+--disable_query_log
+EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig;
+EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig;
+--enable_query_log
diff --git a/mysql-test/suite/encryption/t/innodb-page_encryption.test b/mysql-test/suite/encryption/t/innodb-page_encryption.test
index df2d1d52aaa..463df756933 100644
--- a/mysql-test/suite/encryption/t/innodb-page_encryption.test
+++ b/mysql-test/suite/encryption/t/innodb-page_encryption.test
@@ -1,6 +1,14 @@
-- source include/have_innodb.inc
-- source include/have_file_key_management_plugin.inc
+--disable_query_log
+let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
+let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
+--enable_query_log
+
+SET GLOBAL innodb_file_format = `Barracuda`;
+SET GLOBAL innodb_file_per_table = ON;
+
create table innodb_normal(c1 bigint not null, b char(200)) engine=innodb;
show warnings;
create table innodb_compact(c1 bigint not null, b char(200)) engine=innodb row_format=compact encrypted=yes encryption_key_id=1;
@@ -77,6 +85,9 @@ SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_
--source include/restart_mysqld.inc
+SET GLOBAL innodb_file_format = `Barracuda`;
+SET GLOBAL innodb_file_per_table = ON;
+
update innodb_normal set c1 = c1 +1;
update innodb_compact set c1 = c1 + 1;
update innodb_compressed set c1 = c1 + 1;
@@ -113,6 +124,9 @@ show create table innodb_redundant;
--source include/restart_mysqld.inc
+SET GLOBAL innodb_file_format = `Barracuda`;
+SET GLOBAL innodb_file_per_table = ON;
+
show create table innodb_compact;
show create table innodb_compressed;
show create table innodb_dynamic;
@@ -147,3 +161,9 @@ drop table innodb_compressed;
drop table innodb_dynamic;
drop table innodb_redundant;
drop table innodb_defkey;
+
+# reset system
+--disable_query_log
+EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig;
+EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig;
+--enable_query_log
diff --git a/mysql-test/suite/encryption/t/innodb-page_encryption_compression.test b/mysql-test/suite/encryption/t/innodb-page_encryption_compression.test
index 2fe29e0cb5c..fc11aa1676d 100644
--- a/mysql-test/suite/encryption/t/innodb-page_encryption_compression.test
+++ b/mysql-test/suite/encryption/t/innodb-page_encryption_compression.test
@@ -1,15 +1,19 @@
-- source include/have_innodb.inc
--- source include/not_embedded.inc
-- source include/have_file_key_management_plugin.inc
--- source include/big_test.inc
-# Test heavy not tested on valgrind
--- source include/not_valgrind.inc
+-- source include/not_embedded.inc
+--disable_query_log
let $innodb_compression_algorithm_orig=`SELECT @@innodb_compression_algorithm`;
-let $encryption = `SELECT @@innodb_encrypt_tables`;
+let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
+let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
+--enable_query_log
+--disable_warnings
+SET GLOBAL innodb_file_format = `Barracuda`;
+SET GLOBAL innodb_file_per_table = ON;
# zlib
set global innodb_compression_algorithm = 1;
+--enable_warnings
create table innodb_normal(c1 bigint not null, b char(200)) engine=innodb page_compressed=1;
show warnings;
@@ -35,50 +39,24 @@ end//
delimiter ;//
commit;
-set autocommit=0;
-call innodb_insert_proc(5000);
-commit;
-set autocommit=1;
-
+begin;
+call innodb_insert_proc(2000);
insert into innodb_compact select * from innodb_normal;
insert into innodb_dynamic select * from innodb_normal;
+commit;
-update innodb_normal set c1 = c1 + 1;
-update innodb_compact set c1 = c1 + 1;
-update innodb_dynamic set c1 = c1 + 1;
-select count(*) from innodb_normal;
-select count(*) from innodb_compact where c1 < 1500000;
-select count(*) from innodb_dynamic where c1 < 1500000;
-select count(*) from innodb_compact t1, innodb_normal t2 where
-t1.c1 = t2.c1 and t1.b = t2.b;
-select count(*) from innodb_dynamic t1, innodb_normal t2 where
-t1.c1 = t2.c1 and t1.b = t2.b;
-
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted';
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted';
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_compressed';
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decompressed';
+let $wait_condition= select variable_value > 0 from information_schema.global_status where variable_name = 'INNODB_NUM_PAGES_PAGE_COMPRESSED';
+--source include/wait_condition.inc
+--let $restart_parameters=--innodb-encrypt-tables=OFF
--source include/restart_mysqld.inc
+--disable_warnings
+SET GLOBAL innodb_file_format = `Barracuda`;
+SET GLOBAL innodb_file_per_table = ON;
# zlib
set global innodb_compression_algorithm = 1;
-
-update innodb_normal set c1 = c1 + 1;
-update innodb_compact set c1 = c1 + 1;
-update innodb_dynamic set c1 = c1 + 1;
-select count(*) from innodb_normal;
-select count(*) from innodb_compact where c1 < 1500000;
-select count(*) from innodb_dynamic where c1 < 1500000;
-select count(*) from innodb_compact t1, innodb_normal t2 where
-t1.c1 = t2.c1 and t1.b = t2.b;
-select count(*) from innodb_dynamic t1, innodb_normal t2 where
-t1.c1 = t2.c1 and t1.b = t2.b;
-
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted';
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted';
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_compressed';
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decompressed';
+--enable_warnings
alter table innodb_normal engine=innodb page_compressed=DEFAULT;
show create table innodb_normal;
@@ -87,27 +65,8 @@ show create table innodb_compact;
alter table innodb_dynamic engine=innodb encrypted=DEFAULT encryption_key_id=DEFAULT page_compressed=DEFAULT;
show create table innodb_dynamic;
---source include/restart_mysqld.inc
-
-show create table innodb_normal;
-show create table innodb_compact;
-show create table innodb_dynamic;
-
-update innodb_normal set c1 = c1 + 1;
-update innodb_compact set c1 = c1 + 1;
-update innodb_dynamic set c1 = c1 + 1;
-select count(*) from innodb_normal;
-select count(*) from innodb_compact where c1 < 1500000;
-select count(*) from innodb_dynamic where c1 < 1500000;
-select count(*) from innodb_compact t1, innodb_normal t2 where
-t1.c1 = t2.c1 and t1.b = t2.b;
-select count(*) from innodb_dynamic t1, innodb_normal t2 where
-t1.c1 = t2.c1 and t1.b = t2.b;
-
-SELECT variable_value = 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted';
-SELECT variable_value = 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted';
-SELECT variable_value = 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_compressed';
-SELECT variable_value = 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decompressed';
+let $wait_condition= select variable_value > 0 from information_schema.global_status where variable_name = 'INNODB_NUM_PAGES_PAGE_DECOMPRESSED';
+--source include/wait_condition.inc
drop procedure innodb_insert_proc;
drop table innodb_normal;
@@ -117,5 +76,6 @@ drop table innodb_dynamic;
# reset system
--disable_query_log
EVAL SET GLOBAL innodb_compression_algorithm = $innodb_compression_algorithm_orig;
-EVAL SET GLOBAL innodb_encrypt_tables = $encryption;
+EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig;
+EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig;
--enable_query_log
diff --git a/mysql-test/suite/encryption/t/innodb-page_encryption_log_encryption.test b/mysql-test/suite/encryption/t/innodb-page_encryption_log_encryption.test
index f7eab67154d..79dc447e352 100644
--- a/mysql-test/suite/encryption/t/innodb-page_encryption_log_encryption.test
+++ b/mysql-test/suite/encryption/t/innodb-page_encryption_log_encryption.test
@@ -2,9 +2,14 @@
-- source include/not_embedded.inc
-- source include/have_file_key_management_plugin.inc
-call mtr.add_suppression("KeyID 0 not found or with error. Check the key and the log*");
-call mtr.add_suppression("Disabling redo log encryp*");
-call mtr.add_suppression("InnoDB: Redo log crypto: Can't initialize to key version*");
+#call mtr.add_suppression("KeyID 0 not found or with error. Check the key and the log.*");
+#call mtr.add_suppression("Disabling redo log encryp.*");
+#call mtr.add_suppression("InnoDB: Redo log crypto: Can't initialize to key version.*");
+
+--disable_warnings
+SET GLOBAL innodb_file_format = `Barracuda`;
+SET GLOBAL innodb_file_per_table = ON;
+--enable_warnings
create table innodb_normal(c1 bigint not null, b char(200)) engine=innodb;
show warnings;
@@ -35,61 +40,41 @@ end//
delimiter ;//
commit;
-set autocommit=0;
+begin;
call innodb_insert_proc(2000);
-commit;
-set autocommit=1;
-
insert into innodb_compact select * from innodb_normal;
insert into innodb_compressed select * from innodb_normal;
insert into innodb_dynamic select * from innodb_normal;
insert into innodb_redundant select * from innodb_normal;
+commit;
-update innodb_normal set c1 = c1 +1;
-update innodb_compact set c1 = c1 + 1;
-update innodb_compressed set c1 = c1 + 1;
-update innodb_dynamic set c1 = c1 + 1;
-update innodb_redundant set c1 = c1 + 1;
-select count(*) from innodb_compact where c1 < 1500000;
-select count(*) from innodb_compressed where c1 < 1500000;
-select count(*) from innodb_dynamic where c1 < 1500000;
-select count(*) from innodb_redundant where c1 < 1500000;
-select count(*) from innodb_compact t1, innodb_normal t2 where
-t1.c1 = t2.c1 and t1.b = t2.b;
-select count(*) from innodb_dynamic t1, innodb_normal t2 where
-t1.c1 = t2.c1 and t1.b = t2.b;
-select count(*) from innodb_compressed t1, innodb_normal t2 where
-t1.c1 = t2.c1 and t1.b = t2.b;
-select count(*) from innodb_redundant t1, innodb_normal t2 where
-t1.c1 = t2.c1 and t1.b = t2.b;
+let $wait_condition= select variable_value > 0 from information_schema.global_status where variable_name = 'INNODB_NUM_PAGES_ENCRYPTED';
+--source include/wait_condition.inc
# Note there that these variables are updated only when real I/O is done, thus they are not reliable
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted';
+SELECT variable_value > 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted';
SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted';
--source include/restart_mysqld.inc
+--disable_warnings
+SET GLOBAL innodb_file_format = `Barracuda`;
+SET GLOBAL innodb_file_per_table = ON;
+--enable_warnings
+
update innodb_normal set c1 = c1 +1;
update innodb_compact set c1 = c1 + 1;
update innodb_compressed set c1 = c1 + 1;
update innodb_dynamic set c1 = c1 + 1;
update innodb_redundant set c1 = c1 + 1;
-select count(*) from innodb_compact where c1 < 1500000;
-select count(*) from innodb_compressed where c1 < 1500000;
-select count(*) from innodb_dynamic where c1 < 1500000;
-select count(*) from innodb_redundant where c1 < 1500000;
-select count(*) from innodb_compact t1, innodb_normal t2 where
-t1.c1 = t2.c1 and t1.b = t2.b;
-select count(*) from innodb_dynamic t1, innodb_normal t2 where
-t1.c1 = t2.c1 and t1.b = t2.b;
-select count(*) from innodb_compressed t1, innodb_normal t2 where
-t1.c1 = t2.c1 and t1.b = t2.b;
-select count(*) from innodb_redundant t1, innodb_normal t2 where
-t1.c1 = t2.c1 and t1.b = t2.b;
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted';
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted';
+let $wait_condition= select variable_value > 0 from information_schema.global_status where variable_name = 'INNODB_NUM_PAGES_ENCRYPTED';
+--source include/wait_condition.inc
+
+SELECT variable_value > 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted';
+SELECT variable_value > 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted';
+SET GLOBAL innodb_encrypt_tables=OFF;
alter table innodb_compact engine=innodb encrypted=DEFAULT encryption_key_id=DEFAULT;
show create table innodb_compact;
alter table innodb_compressed engine=innodb encrypted=DEFAULT encryption_key_id=DEFAULT;
@@ -99,30 +84,8 @@ show create table innodb_dynamic;
alter table innodb_redundant engine=innodb encrypted=DEFAULT encryption_key_id=DEFAULT;
show create table innodb_redundant;
---source include/restart_mysqld.inc
-
-show create table innodb_compact;
-show create table innodb_compressed;
-show create table innodb_dynamic;
-show create table innodb_redundant;
-
-update innodb_normal set c1 = c1 +1;
-update innodb_compact set c1 = c1 + 1;
-update innodb_compressed set c1 = c1 + 1;
-update innodb_dynamic set c1 = c1 + 1;
-update innodb_redundant set c1 = c1 + 1;
-select count(*) from innodb_compact where c1 < 1500000;
-select count(*) from innodb_compressed where c1 < 1500000;
-select count(*) from innodb_dynamic where c1 < 1500000;
-select count(*) from innodb_redundant where c1 < 1500000;
-select count(*) from innodb_compact t1, innodb_normal t2 where
-t1.c1 = t2.c1 and t1.b = t2.b;
-select count(*) from innodb_dynamic t1, innodb_normal t2 where
-t1.c1 = t2.c1 and t1.b = t2.b;
-select count(*) from innodb_compressed t1, innodb_normal t2 where
-t1.c1 = t2.c1 and t1.b = t2.b;
-select count(*) from innodb_redundant t1, innodb_normal t2 where
-t1.c1 = t2.c1 and t1.b = t2.b;
+let $wait_condition= select variable_value > 0 from information_schema.global_status where variable_name = 'INNODB_NUM_PAGES_DECRYPTED';
+--source include/wait_condition.inc
SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted';
SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted';
@@ -133,10 +96,12 @@ drop table innodb_compact;
drop table innodb_compressed;
drop table innodb_dynamic;
drop table innodb_redundant;
-
#
# MDEV-8143: InnoDB: Database page corruption on disk or a failed file read
#
+SET GLOBAL innodb_file_format = `Barracuda`;
+SET GLOBAL innodb_file_per_table = ON;
+
CREATE TABLE t1 (pk INT PRIMARY KEY) ENGINE=InnoDB ENCRYPTION_KEY_ID=2 ENCRYPTED=YES;
INSERT INTO t1 VALUES (1),(2);
diff --git a/mysql-test/suite/encryption/t/innodb-redo-badkey.opt b/mysql-test/suite/encryption/t/innodb-redo-badkey.opt
new file mode 100644
index 00000000000..343128e8803
--- /dev/null
+++ b/mysql-test/suite/encryption/t/innodb-redo-badkey.opt
@@ -0,0 +1,5 @@
+--innodb-change-buffering=all
+--innodb-encrypt-tables=on
+--innodb-tablespaces-encryption
+--innodb-encryption-threads=2
+--innodb-default-encryption-key-id=4
diff --git a/mysql-test/suite/encryption/t/innodb-redo-badkey.test b/mysql-test/suite/encryption/t/innodb-redo-badkey.test
new file mode 100644
index 00000000000..159646541c7
--- /dev/null
+++ b/mysql-test/suite/encryption/t/innodb-redo-badkey.test
@@ -0,0 +1,100 @@
+-- source include/have_innodb.inc
+-- source include/have_file_key_management_plugin.inc
+# embedded does not support restart
+-- source include/not_embedded.inc
+
+call mtr.add_suppression("InnoDB: Block in space_id .* in file .* encrypted.");
+call mtr.add_suppression("Plugin 'file_key_management' .*");
+call mtr.add_suppression("Plugin 'InnoDB' init function returned error.");
+call mtr.add_suppression("Plugin 'InnoDB' registration as a STORAGE ENGINE failed.");
+call mtr.add_suppression("InnoDB: Read operation failed for tablespace .*");
+call mtr.add_suppression("InnoDB: Database page corruption on disk or a failed.*");
+call mtr.add_suppression("InnoDB: Recovery read page .*");
+call mtr.add_suppression("InnoDB: The page \[page id: space=[0-9]+, page number=[0-9]+\] in file test/t2 cannot be decrypted.");
+call mtr.add_suppression("InnoDB: The page \[page id: space=[0-9]+, page number=[0-9]+\] in file test/t3 cannot be decrypted.");
+call mtr.add_suppression("InnoDB: The page \[page id: space=[0-9]+, page number=[0-9]+\] in file test/t4 cannot be decrypted.");
+call mtr.add_suppression("InnoDB: The page \[page id: space=[0-9]+, page number=[0-9]+\] in file test/t1 cannot be decrypted.");
+call mtr.add_suppression("InnoDB: Missing MLOG_FILE_NAME or MLOG_FILE_DELETE .*");
+call mtr.add_suppression("InnoDB: Plugin initialization aborted .*");
+call mtr.add_suppression("InnoDB: ############### CORRUPT LOG RECORD FOUND ##################");
+
+--echo # Restart mysqld --file-key-management-filename=keys2.txt
+-- let $restart_parameters=--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys2.txt
+-- source include/restart_mysqld.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
+
+--disable_warnings
+SET GLOBAL innodb_file_format = `Barracuda`;
+SET GLOBAL innodb_file_per_table = ON;
+--enable_warnings
+
+create table t1(a int not null primary key auto_increment, c char(250), b blob, index(b(10))) engine=innodb row_format=compressed encrypted=yes encryption_key_id=4;
+create table t2(a int not null primary key auto_increment, c char(250), b blob, index(b(10))) engine=innodb row_format=compressed;
+create table t3(a int not null primary key auto_increment, c char(250), b blob, index(b(10))) engine=innodb encrypted=yes encryption_key_id=4;
+create table t4(a int not null primary key auto_increment, c char(250), b blob, index(b(10))) engine=innodb;
+
+begin;
+--disable_query_log
+--let $i = 20
+begin;
+while ($i)
+{
+ insert into t1(c,b) values (repeat('secret1',20), repeat('secret2',6000));
+ dec $i;
+}
+--enable_query_log
+
+insert into t2 select * from t1;
+insert into t3 select * from t1;
+insert into t4 select * from t1;
+commit;
+
+--source ../../suite/innodb/include/no_checkpoint_start.inc
+
+#
+# We test redo log page read at recv_read_page using
+# incorrect keys from std_data/keys.txt. If checkpoint
+# happens we will skip this test. If no checkpoint
+# happens, InnoDB refuses to start as used
+# encryption key is incorrect.
+#
+SET GLOBAL innodb_flush_log_at_trx_commit=1;
+begin;
+update t1 set c = repeat('secret3', 20);
+update t2 set c = repeat('secret4', 20);
+update t3 set c = repeat('secret4', 20);
+update t4 set c = repeat('secret4', 20);
+insert into t1 (c,b) values (repeat('secret5',20), repeat('secret6',6000));
+insert into t2 (c,b) values (repeat('secret7',20), repeat('secret8',6000));
+insert into t3 (c,b) values (repeat('secret9',20), repeat('secre10',6000));
+insert into t4 (c,b) values (repeat('secre11',20), repeat('secre12',6000));
+COMMIT;
+let $cleanup= drop table t1,t2,t3,t4;
+--let CLEANUP_IF_CHECKPOINT= $cleanup;
+--source ../../suite/innodb/include/no_checkpoint_end.inc
+
+--echo # restart
+--error 1
+-- source include/start_mysqld.inc
+--source include/kill_mysqld.inc
+
+#
+# Now test with innodb-force-recovery=1 i.e. ignore corrupt pages
+#
+
+--echo # Restart mysqld --innodb-force-recovery=1
+-- let $restart_parameters=--innodb-force-recovery=1
+--error 1
+-- source include/start_mysqld.inc
+
+--source include/kill_mysqld.inc
+
+--echo # Restart mysqld --file-key-management-filename=keys2.txt
+-- let $restart_parameters=--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys2.txt
+-- source include/start_mysqld.inc
+
+drop table t1, t2,t3,t4;
diff --git a/mysql-test/suite/encryption/t/innodb-redo-nokeys.opt b/mysql-test/suite/encryption/t/innodb-redo-nokeys.opt
new file mode 100644
index 00000000000..21afc19fc5d
--- /dev/null
+++ b/mysql-test/suite/encryption/t/innodb-redo-nokeys.opt
@@ -0,0 +1,3 @@
+--innodb-change-buffering=none
+--innodb-encrypt-tables=on
+--innodb-default-encryption-key-id=20
diff --git a/mysql-test/suite/encryption/t/innodb-redo-nokeys.test b/mysql-test/suite/encryption/t/innodb-redo-nokeys.test
new file mode 100644
index 00000000000..e55e2ade153
--- /dev/null
+++ b/mysql-test/suite/encryption/t/innodb-redo-nokeys.test
@@ -0,0 +1,80 @@
+-- source include/have_innodb.inc
+-- source include/have_file_key_management_plugin.inc
+# embedded does not support restart
+-- source include/not_embedded.inc
+
+call mtr.add_suppression("InnoDB: Block in space_id .*");
+call mtr.add_suppression("mysqld: File .*");
+call mtr.add_suppression("Plugin 'file_key_management' .*");
+call mtr.add_suppression("InnoDB: cannot enable encryption, encryption plugin is not available");
+call mtr.add_suppression("Plugin 'InnoDB' init function returned error.");
+call mtr.add_suppression("Plugin 'InnoDB' registration as a STORAGE ENGINE failed.");
+call mtr.add_suppression("InnoDB: The page \[page id: space=[0-9]+, page number=[0-9]+\] in file test/t2 cannot be decrypted.");
+call mtr.add_suppression("InnoDB: The page \[page id: space=[0-9]+, page number=[0-9]+\] in file test/t3 cannot be decrypted.");
+call mtr.add_suppression("InnoDB: The page \[page id: space=[0-9]+, page number=[0-9]+\] in file test/t4 cannot be decrypted.");
+call mtr.add_suppression("InnoDB: The page \[page id: space=[0-9]+, page number=[0-9]+\] in file test/t1 cannot be decrypted.");
+
+--echo # Restart mysqld --file-key-management-filename=keys2.txt
+-- let $restart_parameters=--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys2.txt
+-- source include/restart_mysqld.inc
+
+--disable_warnings
+SET GLOBAL innodb_file_format = `Barracuda`;
+SET GLOBAL innodb_file_per_table = ON;
+--enable_warnings
+
+create table t1(a int not null primary key auto_increment, c char(200), b blob, index(b(10))) engine=innodb row_format=compressed encrypted=yes encryption_key_id=20;
+create table t2(a int not null primary key auto_increment, c char(200), b blob, index(b(10))) engine=innodb row_format=compressed;
+create table t3(a int not null primary key auto_increment, c char(200), b blob, index(b(10))) engine=innodb encrypted=yes encryption_key_id=20;
+create table t4(a int not null primary key auto_increment, c char(200), b blob, index(b(10))) engine=innodb;
+
+begin;
+--disable_query_log
+--let $i = 20
+begin;
+while ($i)
+{
+ insert into t1(c,b) values (repeat('secret1',20), repeat('secret2',6000));
+ dec $i;
+}
+--enable_query_log
+
+insert into t2 select * from t1;
+insert into t3 select * from t1;
+insert into t4 select * from t1;
+commit;
+
+--source ../../suite/innodb/include/no_checkpoint_start.inc
+#
+# We test redo log page read at recv_read_page using
+# keys that are not in std_data/keys.txt. If checkpoint
+# happens we will skip this test. If no checkpoint
+# happens, InnoDB refuses to start as used
+# encryption key is not found.
+#
+SET GLOBAL innodb_flush_log_at_trx_commit=1;
+begin;
+update t1 set c = repeat('secret3', 20);
+update t2 set c = repeat('secret4', 20);
+update t3 set c = repeat('secret4', 20);
+update t4 set c = repeat('secret4', 20);
+insert into t1 (c,b) values (repeat('secret5',20), repeat('secret6',6000));
+insert into t2 (c,b) values (repeat('secret7',20), repeat('secret8',6000));
+insert into t3 (c,b) values (repeat('secret9',20), repeat('secre10',6000));
+insert into t4 (c,b) values (repeat('secre11',20), repeat('secre12',6000));
+COMMIT;
+let $cleanup= drop table t1,t2,t3,t4;
+--let CLEANUP_IF_CHECKPOINT= $cleanup;
+--source ../../suite/innodb/include/no_checkpoint_end.inc
+
+--echo # restart
+-- source include/start_mysqld.inc
+#
+# In above server does start but InnoDB refuses to start
+# thus we need to restart server with correct key file
+#
+--echo # Restart mysqld --file-key-management-filename=keys2.txt
+-- let $restart_parameters=--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys2.txt
+-- source include/restart_mysqld.inc
+
+drop table t1, t2,t3,t4;
diff --git a/mysql-test/suite/encryption/t/innodb_encryption-page-compression.test b/mysql-test/suite/encryption/t/innodb_encryption-page-compression.test
index 606662e44e6..ea6bd65d605 100644
--- a/mysql-test/suite/encryption/t/innodb_encryption-page-compression.test
+++ b/mysql-test/suite/encryption/t/innodb_encryption-page-compression.test
@@ -1,15 +1,20 @@
-- source include/have_innodb.inc
-- source include/have_example_key_management_plugin.inc
-# embedded does not support restart
--- source include/not_embedded.inc
-
+--disable_query_log
let $innodb_compression_algorithm_orig=`SELECT @@innodb_compression_algorithm`;
+let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
+let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
let $innodb_encrypt_tables_orig = `SELECT @@innodb_encrypt_tables`;
let $innodb_encryption_threads_orig = `SELECT @@innodb_encryption_threads`;
+--enable_query_log
+--disable_warnings
+SET GLOBAL innodb_file_format = `Barracuda`;
+SET GLOBAL innodb_file_per_table = ON;
SET GLOBAL innodb_encryption_threads = 4;
SET GLOBAL innodb_encrypt_tables = on;
+--enable_warnings
# zlib
set global innodb_compression_algorithm = 1;
@@ -56,11 +61,8 @@ end//
delimiter ;//
commit;
-set autocommit=0;
-call innodb_insert_proc(5000);
-commit;
-set autocommit=1;
-select count(*) from innodb_normal;
+begin;
+call innodb_insert_proc(2000);
insert into innodb_page_compressed1 select * from innodb_normal;
insert into innodb_page_compressed2 select * from innodb_normal;
insert into innodb_page_compressed3 select * from innodb_normal;
@@ -71,23 +73,6 @@ insert into innodb_page_compressed7 select * from innodb_normal;
insert into innodb_page_compressed8 select * from innodb_normal;
insert into innodb_page_compressed9 select * from innodb_normal;
commit;
-select count(*) from innodb_page_compressed1 where c1 < 500000;
-select count(*) from innodb_page_compressed2 where c1 < 500000;
-select count(*) from innodb_page_compressed3 where c1 < 500000;
-select count(*) from innodb_page_compressed4 where c1 < 500000;
-select count(*) from innodb_page_compressed5 where c1 < 500000;
-select count(*) from innodb_page_compressed6 where c1 < 500000;
-select count(*) from innodb_page_compressed7 where c1 < 500000;
-select count(*) from innodb_page_compressed8 where c1 < 500000;
-select count(*) from innodb_page_compressed9 where c1 < 500000;
-
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted';
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted';
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_page_compressed';
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_page_decompressed';
-
-
---source include/restart_mysqld.inc
select count(*) from innodb_page_compressed1 where c1 < 500000;
select count(*) from innodb_page_compressed2 where c1 < 500000;
@@ -98,33 +83,18 @@ select count(*) from innodb_page_compressed6 where c1 < 500000;
select count(*) from innodb_page_compressed7 where c1 < 500000;
select count(*) from innodb_page_compressed8 where c1 < 500000;
select count(*) from innodb_page_compressed9 where c1 < 500000;
-update innodb_page_compressed1 set c1 = c1 + 1;
-update innodb_page_compressed2 set c1 = c1 + 1;
-update innodb_page_compressed3 set c1 = c1 + 1;
-update innodb_page_compressed4 set c1 = c1 + 1;
-update innodb_page_compressed5 set c1 = c1 + 1;
-update innodb_page_compressed6 set c1 = c1 + 1;
-update innodb_page_compressed7 set c1 = c1 + 1;
-update innodb_page_compressed8 set c1 = c1 + 1;
-update innodb_page_compressed9 set c1 = c1 + 1;
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted';
+let $wait_condition= select variable_value > 0 from information_schema.global_status where variable_name = 'INNODB_NUM_PAGES_PAGE_COMPRESSED';
+--source include/wait_condition.inc
+
+SELECT variable_value > 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted';
SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted';
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_page_compressed';
+SELECT variable_value > 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_page_compressed';
SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_page_decompressed';
SET GLOBAL innodb_encryption_threads = 4;
SET GLOBAL innodb_encrypt_tables = off;
-select count(*) from innodb_page_compressed1 where c1 < 500000;
-select count(*) from innodb_page_compressed2 where c1 < 500000;
-select count(*) from innodb_page_compressed3 where c1 < 500000;
-select count(*) from innodb_page_compressed4 where c1 < 500000;
-select count(*) from innodb_page_compressed5 where c1 < 500000;
-select count(*) from innodb_page_compressed6 where c1 < 500000;
-select count(*) from innodb_page_compressed7 where c1 < 500000;
-select count(*) from innodb_page_compressed8 where c1 < 500000;
-select count(*) from innodb_page_compressed9 where c1 < 500000;
update innodb_page_compressed1 set c1 = c1 + 1;
update innodb_page_compressed2 set c1 = c1 + 1;
update innodb_page_compressed3 set c1 = c1 + 1;
@@ -135,9 +105,12 @@ update innodb_page_compressed7 set c1 = c1 + 1;
update innodb_page_compressed8 set c1 = c1 + 1;
update innodb_page_compressed9 set c1 = c1 + 1;
+let $wait_condition= select variable_value > 0 from information_schema.global_status where variable_name = 'INNODB_NUM_PAGES_DECRYPTED';
+--source include/wait_condition.inc
+
SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted';
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted';
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_page_compressed';
+SELECT variable_value > 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted';
+SELECT variable_value > 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_page_compressed';
SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_page_decompressed';
drop procedure innodb_insert_proc;
@@ -155,6 +128,9 @@ drop table innodb_page_compressed9;
# reset system
--disable_query_log
EVAL SET GLOBAL innodb_compression_algorithm = $innodb_compression_algorithm_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_encrypt_tables = $innodb_encrypt_tables_orig;
EVAL SET GLOBAL innodb_encryption_threads = $innodb_encryption_threads_orig;
--enable_query_log
+
diff --git a/mysql-test/suite/encryption/t/innodb_encryption_discard_import.test b/mysql-test/suite/encryption/t/innodb_encryption_discard_import.test
index 075cb1cf77e..192233a535f 100644
--- a/mysql-test/suite/encryption/t/innodb_encryption_discard_import.test
+++ b/mysql-test/suite/encryption/t/innodb_encryption_discard_import.test
@@ -3,8 +3,7 @@
-- source include/not_valgrind.inc
-- source include/not_embedded.inc
-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.");
+call mtr.add_suppression("InnoDB: Table .* tablespace is set as discarded.");
let $MYSQLD_TMPDIR = `SELECT @@tmpdir`;
let $MYSQLD_DATADIR = `SELECT @@datadir`;
@@ -15,6 +14,16 @@ let $MYSQLD_DATADIR = `SELECT @@datadir`;
--let t2_IBD = $MYSQLD_DATADIR/test/t2.ibd
--let t3_IBD = $MYSQLD_DATADIR/test/t3.ibd
+--disable_query_log
+let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
+let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
+--enable_query_log
+
+--disable_warnings
+SET GLOBAL innodb_file_format = `Barracuda`;
+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 t2 (id INT NOT NULL PRIMARY KEY, a VARCHAR(255)) ENGINE=InnoDB;
CREATE TABLE t3 (id INT NOT NULL PRIMARY KEY, a VARCHAR(255)) ENGINE=InnoDB row_format=compressed encrypted=yes;
@@ -144,3 +153,11 @@ SELECT COUNT(1) FROM t3;
DROP PROCEDURE innodb_insert_proc;
DROP TABLE t1, t2, t3;
+
+# reset system
+--disable_warnings
+--disable_query_log
+EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig;
+EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig;
+--enable_query_log
+--enable_warnings
diff --git a/mysql-test/suite/encryption/t/innodb_encryption_filekeys.test b/mysql-test/suite/encryption/t/innodb_encryption_filekeys.test
index 47d546ae698..8f0986071f1 100644
--- a/mysql-test/suite/encryption/t/innodb_encryption_filekeys.test
+++ b/mysql-test/suite/encryption/t/innodb_encryption_filekeys.test
@@ -5,9 +5,15 @@
call mtr.add_suppression("trying to do an operation on a dropped tablespace .*");
+--disable_query_log
+let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
+let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
let $encrypt_tables = `SELECT @@innodb_encrypt_tables`;
let $threads = `SELECT @@innodb_encryption_threads`;
+--enable_query_log
+SET GLOBAL innodb_file_format = `Barracuda`;
+SET GLOBAL innodb_file_per_table = ON;
SET GLOBAL innodb_encrypt_tables = OFF;
SET GLOBAL innodb_encryption_threads = 4;
@@ -127,6 +133,8 @@ SELECT COUNT(1) FROM t5;
# reset system
--disable_query_log
+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_encrypt_tables = $encrypt_tables;
EVAL SET GLOBAL innodb_encryption_threads = $threads;
--enable_query_log
@@ -134,3 +142,4 @@ EVAL SET GLOBAL innodb_encryption_threads = $threads;
drop table t1,t2,t3,t4, t5;
set GLOBAL innodb_default_encryption_key_id=1;
+
diff --git a/mysql-test/suite/encryption/t/innodb_encryption_is.test b/mysql-test/suite/encryption/t/innodb_encryption_is.test
index 52574aa2b9d..333bb84c634 100644
--- a/mysql-test/suite/encryption/t/innodb_encryption_is.test
+++ b/mysql-test/suite/encryption/t/innodb_encryption_is.test
@@ -1,6 +1,14 @@
-- source include/have_innodb.inc
-- source include/have_file_key_management_plugin.inc
+--disable_query_log
+let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
+let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
+--enable_query_log
+
+SET GLOBAL innodb_file_format = `Barracuda`;
+SET GLOBAL innodb_file_per_table = ON;
+
CREATE TABLE t1 (c VARCHAR(8)) ENGINE=InnoDB ENCRYPTED=YES ENCRYPTION_KEY_ID=1;
CREATE TABLE t2 (c VARCHAR(8)) ENGINE=InnoDB ENCRYPTED=YES ENCRYPTION_KEY_ID=2;
INSERT INTO t1 VALUES ('foobar');
@@ -15,3 +23,9 @@ FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION
WHERE NAME LIKE '%t1' OR NAME LIKE '%t2';
DROP TABLE t1, t2;
+
+# reset system
+--disable_query_log
+EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig;
+EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig;
+--enable_query_log
diff --git a/mysql-test/suite/encryption/t/innodb_encryption_row_compressed.test b/mysql-test/suite/encryption/t/innodb_encryption_row_compressed.test
index d6319164c35..0a28c1690a2 100644
--- a/mysql-test/suite/encryption/t/innodb_encryption_row_compressed.test
+++ b/mysql-test/suite/encryption/t/innodb_encryption_row_compressed.test
@@ -2,6 +2,14 @@
-- source include/have_file_key_management_plugin.inc
-- source include/not_embedded.inc
+--disable_query_log
+let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
+let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
+--enable_query_log
+
+SET GLOBAL innodb_file_format = `Barracuda`;
+SET GLOBAL innodb_file_per_table = ON;
+
create table innodb_compressed1(c1 bigint not null primary key, d int, a varchar(20), b char(200)) engine=innodb row_format=compressed encrypted=yes;
create table innodb_compressed2(c1 bigint not null primary key, d int, a varchar(20), b char(200)) engine=innodb row_format=compressed key_block_size=1 encrypted=yes;
create table innodb_compressed3(c1 bigint not null primary key, d int, a varchar(20), b char(200)) engine=innodb row_format=compressed key_block_size=2 encrypted=yes;
@@ -44,6 +52,9 @@ insert into innodb_compressed4 select * from innodb_compressed1;
-- let SEARCH_FILE=$t4_IBD
-- source include/search_pattern_in_file.inc
+SET GLOBAL innodb_file_format = `Barracuda`;
+SET GLOBAL innodb_file_per_table = ON;
+
select * from innodb_compressed1 where d = 20;
select * from innodb_compressed1 where d = 30;
select * from innodb_compressed2 where d = 20;
@@ -106,3 +117,9 @@ drop table innodb_compressed1;
drop table innodb_compressed2;
drop table innodb_compressed3;
drop table innodb_compressed4;
+
+# reset system
+--disable_query_log
+EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig;
+EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig;
+--enable_query_log
diff --git a/mysql-test/suite/encryption/t/innodb_encryption_tables.test b/mysql-test/suite/encryption/t/innodb_encryption_tables.test
index bc762faf12e..f806b776800 100644
--- a/mysql-test/suite/encryption/t/innodb_encryption_tables.test
+++ b/mysql-test/suite/encryption/t/innodb_encryption_tables.test
@@ -2,6 +2,14 @@
-- source include/have_example_key_management_plugin.inc
-- source include/not_embedded.inc
+--disable_query_log
+let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
+let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
+--enable_query_log
+
+SET GLOBAL innodb_file_format = `Barracuda`;
+SET GLOBAL innodb_file_per_table = ON;
+
create table innodb_normal(c1 bigint not null, b char(200)) engine=innodb;
create table innodb_compact(c1 bigint not null, b char(200)) engine=innodb row_format=compact;
create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic;
@@ -65,6 +73,9 @@ SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_
--source include/restart_mysqld.inc
+SET GLOBAL innodb_file_format = `Barracuda`;
+SET GLOBAL innodb_file_per_table = ON;
+
update innodb_normal set c1 = c1 + 1;
update innodb_compact set c1 = c1 + 1;
update innodb_dynamic set c1 = c1 + 1;
@@ -95,3 +106,9 @@ drop table innodb_compact;
drop table innodb_dynamic;
drop table innodb_compressed;
drop table innodb_redundant;
+
+# reset system
+--disable_query_log
+EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig;
+EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig;
+--enable_query_log
diff --git a/mysql-test/suite/encryption/t/innodb_first_page.test b/mysql-test/suite/encryption/t/innodb_first_page.test
index 58095e5e110..a0c563b1854 100644
--- a/mysql-test/suite/encryption/t/innodb_first_page.test
+++ b/mysql-test/suite/encryption/t/innodb_first_page.test
@@ -5,14 +5,25 @@
--source include/have_innodb.inc
--source include/have_file_key_management_plugin.inc
-let $datadir=`select @@datadir`;
---source include/shutdown_mysqld.inc
+call mtr.add_suppression("InnoDB: New log files created, LSN");
+call mtr.add_suppression("InnoDB: Creating foreign key constraint system tables");
+
+let datadir=`select @@datadir`;
+
+--exec echo wait > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+
+shutdown;
+
+--source include/wait_until_disconnected.inc
--remove_file $datadir/ib_logfile0
--remove_file $datadir/ib_logfile1
--remove_file $datadir/ibdata1
---source include/start_mysqld.inc
+--exec echo restart > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+
+--enable_reconnect
+--source include/wait_until_connected_again.inc
create table t1 (a int);
diff --git a/mysql-test/suite/encryption/t/innodb_lotoftables.test b/mysql-test/suite/encryption/t/innodb_lotoftables.test
index 6e87c93df4b..8bad356a9e0 100644
--- a/mysql-test/suite/encryption/t/innodb_lotoftables.test
+++ b/mysql-test/suite/encryption/t/innodb_lotoftables.test
@@ -6,6 +6,8 @@
-- source include/not_embedded.inc
--disable_query_log
+let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
+let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
let $innodb_encryption_threads_orig = `SELECT @@global.innodb_encryption_threads`;
--enable_query_log
@@ -13,6 +15,9 @@ let $innodb_encryption_threads_orig = `SELECT @@global.innodb_encryption_threads
SET GLOBAL innodb_fast_shutdown=0;
--source include/restart_mysqld.inc
+SET GLOBAL innodb_file_format = `Barracuda`;
+SET GLOBAL innodb_file_per_table = ON;
+
SHOW VARIABLES LIKE 'innodb_encrypt%';
#
@@ -270,5 +275,7 @@ drop database innodb_encrypted_2;
drop database innodb_encrypted_3;
--disable_query_log
+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_encryption_threads = $innodb_encryption_threads_orig;
--enable_query_log
diff --git a/mysql-test/suite/encryption/t/innodb_onlinealter_encryption.opt b/mysql-test/suite/encryption/t/innodb_onlinealter_encryption.opt
index bcff011eb82..38d69691ed6 100644
--- a/mysql-test/suite/encryption/t/innodb_onlinealter_encryption.opt
+++ b/mysql-test/suite/encryption/t/innodb_onlinealter_encryption.opt
@@ -3,6 +3,3 @@
--innodb-encryption-rotate-key-age=15
--innodb-encryption-threads=4
--innodb-tablespaces-encryption
---innodb-max-dirty-pages-pct=0.001
-
-
diff --git a/mysql-test/suite/encryption/t/innodb_onlinealter_encryption.test b/mysql-test/suite/encryption/t/innodb_onlinealter_encryption.test
index e7e8405e839..3e308bec247 100644
--- a/mysql-test/suite/encryption/t/innodb_onlinealter_encryption.test
+++ b/mysql-test/suite/encryption/t/innodb_onlinealter_encryption.test
@@ -3,6 +3,11 @@
# test uses restart
-- source include/not_embedded.inc
+--disable_warnings
+SET GLOBAL innodb_file_format = `Barracuda`;
+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 t2 (id INT NOT NULL PRIMARY KEY, a VARCHAR(255)) ENGINE=InnoDB;
CREATE TABLE t3 (id INT, a VARCHAR(255)) ENGINE=InnoDB encrypted=yes;
@@ -17,8 +22,8 @@ begin
declare current_num int;
set current_num = 0;
while current_num < repeat_count do
- insert into t1 values (current_num,repeat('foobar',42));
- insert into t2 values (current_num,repeat('temp', 42));
+ insert into t1 values (current_num,repeat('foobar',12));
+ insert into t2 values (current_num,repeat('tempsecret', 12));
insert into t3 values (current_num,repeat('barfoo',42));
insert into t4 values (current_num,repeat('repeat',42));
insert into t5 values (current_num,substring('A BC DEF GHIJ KLM NOPQRS TUV WXYZ 012 3456789', rand()*36+1, 100), repeat('author new',22));
@@ -42,14 +47,13 @@ set autocommit=1;
--let $MYSQLD_DATADIR=`select @@datadir`
--source include/shutdown_mysqld.inc
---source include/wait_until_disconnected.inc
--let SEARCH_RANGE = 10000000
--let SEARCH_PATTERN=foobar
--echo # t1 yes on expecting NOT FOUND
-- let SEARCH_FILE=$MYSQLD_DATADIR/test/t1.ibd
-- source include/search_pattern_in_file.inc
---let SEARCH_PATTERN=temp
+--let SEARCH_PATTERN=tempsecret
--echo # t2 ... on expecting NOT FOUND
-- let SEARCH_FILE=$MYSQLD_DATADIR/test/t2.ibd
-- source include/search_pattern_in_file.inc
@@ -103,13 +107,12 @@ SHOW CREATE TABLE t6;
SHOW CREATE TABLE t7;
--source include/shutdown_mysqld.inc
---source include/wait_until_disconnected.inc
--let SEARCH_PATTERN=foobar
--echo # t1 yes on expecting NOT FOUND
-- let SEARCH_FILE=$MYSQLD_DATADIR/test/t1.ibd
-- source include/search_pattern_in_file.inc
---let SEARCH_PATTERN=temp
+--let SEARCH_PATTERN=tempsecret
--echo # t2 ... on expecting NOT FOUND
-- let SEARCH_FILE=$MYSQLD_DATADIR/test/t2.ibd
-- source include/search_pattern_in_file.inc
diff --git a/mysql-test/suite/encryption/t/innodb_page_encryption_key_change.test b/mysql-test/suite/encryption/t/innodb_page_encryption_key_change.test
index 1babf577473..7cbf005ed32 100644
--- a/mysql-test/suite/encryption/t/innodb_page_encryption_key_change.test
+++ b/mysql-test/suite/encryption/t/innodb_page_encryption_key_change.test
@@ -7,6 +7,14 @@
-- let $restart_parameters=--loose-file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys2.txt
-- source include/restart_mysqld.inc
+--disable_query_log
+let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
+let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
+--enable_query_log
+
+SET GLOBAL innodb_file_format = `Barracuda`;
+SET GLOBAL innodb_file_per_table = ON;
+
create table innodb_normal(c1 bigint not null, b char(200)) engine=innodb;
show warnings;
create table innodb_compact(c1 bigint not null, b char(200)) engine=innodb row_format=compact encrypted=yes encryption_key_id=2;
@@ -57,6 +65,9 @@ select * from innodb_redundant;
SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted';
SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted';
+SET GLOBAL innodb_file_format = `Barracuda`;
+SET GLOBAL innodb_file_per_table = ON;
+
alter table innodb_compact engine=innodb encryption_key_id = 2;
alter table innodb_compressed engine=innodb encryption_key_id = 3;
alter table innodb_dynamic engine=innodb encryption_key_id = 4;
@@ -77,3 +88,9 @@ drop table innodb_compact;
drop table innodb_compressed;
drop table innodb_dynamic;
drop table innodb_redundant;
+
+# reset system
+--disable_query_log
+EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig;
+EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig;
+--enable_query_log
diff --git a/mysql-test/suite/encryption/t/innodb_scrub.opt b/mysql-test/suite/encryption/t/innodb_scrub.opt
index ef43b2a20a8..3adb645c589 100644
--- a/mysql-test/suite/encryption/t/innodb_scrub.opt
+++ b/mysql-test/suite/encryption/t/innodb_scrub.opt
@@ -2,6 +2,8 @@
--innodb-background-scrub-data-uncompressed=OFF
--innodb-encrypt-tables=OFF
--innodb-encryption-threads=0
+--innodb-file-format=Barracuda
+--innodb-file-per-table=1
--innodb-immediate-scrub-data-uncompressed=ON
--loose-innodb-debug-force-scrubbing=ON
--innodb-tablespaces-scrubbing
diff --git a/mysql-test/suite/encryption/t/innodb_scrub.test b/mysql-test/suite/encryption/t/innodb_scrub.test
index 3288ae9ce1c..6cb48530f86 100644
--- a/mysql-test/suite/encryption/t/innodb_scrub.test
+++ b/mysql-test/suite/encryption/t/innodb_scrub.test
@@ -7,7 +7,7 @@ let INNODB_PAGE_SIZE= `select @@innodb_page_size`;
create table snapshot_status engine = myisam
select * from information_schema.global_status
-where variable_name like 'innodb_scrub_background%';
+where variable_name like 'innodb_scrub%';
let $rowcount=500;
let $maxformatno= 4;
diff --git a/mysql-test/suite/encryption/t/innodb_scrub_background.opt b/mysql-test/suite/encryption/t/innodb_scrub_background.opt
index 04987f4a3ad..1cc525b2402 100644
--- a/mysql-test/suite/encryption/t/innodb_scrub_background.opt
+++ b/mysql-test/suite/encryption/t/innodb_scrub_background.opt
@@ -1,3 +1,5 @@
+--innodb-file-per-table=1
+--innodb-file-format=Barracuda
--innodb-immediate-scrub-data-uncompressed=OFF
--innodb-background-scrub-data-uncompressed=ON
--innodb-background-scrub-data-compressed=ON
diff --git a/mysql-test/suite/encryption/t/tempfiles.test b/mysql-test/suite/encryption/t/tempfiles.test
index 065d775c182..34dcbdf5963 100644
--- a/mysql-test/suite/encryption/t/tempfiles.test
+++ b/mysql-test/suite/encryption/t/tempfiles.test
@@ -7,7 +7,9 @@ source include/have_sequence.inc;
# Row binlog format to fill binlog cache faster
source include/have_binlog_format_row.inc;
-source include/have_innodb.inc;
+# Nothing XtraDB specific in this test, it just needs *some* transactional
+# engine. But there's no need to run it twice for InnoDB and XtraDB.
+source include/have_xtradb.inc;
#
# MyISAM messing around with IO_CACHE::file