summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/include/have_innodb_encryption.inc7
-rw-r--r--mysql-test/include/maria_verify_recovery.inc2
-rw-r--r--mysql-test/include/not_encrypted.inc4
-rw-r--r--mysql-test/include/restart_mysqld.inc9
-rw-r--r--mysql-test/r/information_schema_all_engines.result14
-rw-r--r--mysql-test/r/mysqld--help.result9
-rw-r--r--mysql-test/suite/funcs_1/r/is_engines_innodb.result2
-rw-r--r--mysql-test/suite/innodb/include/keys.txt6
-rw-r--r--mysql-test/suite/innodb/r/innodb-page_encryption.result186
-rw-r--r--mysql-test/suite/innodb/r/innodb-page_encryption_compression.result171
-rw-r--r--mysql-test/suite/innodb/r/innodb_encryption.result57
-rw-r--r--mysql-test/suite/innodb/r/innodb_monitor.result3
-rw-r--r--mysql-test/suite/innodb/r/innodb_scrub.result224
-rw-r--r--mysql-test/suite/innodb/r/innodb_scrub_background.result88
-rw-r--r--mysql-test/suite/innodb/r/innodb_scrub_compressed.result71
-rw-r--r--mysql-test/suite/innodb/t/innodb-page_encryption-32k-master.opt4
-rw-r--r--mysql-test/suite/innodb/t/innodb-page_encryption-32k.test94
-rw-r--r--mysql-test/suite/innodb/t/innodb-page_encryption.opt3
-rw-r--r--mysql-test/suite/innodb/t/innodb-page_encryption.test121
-rw-r--r--mysql-test/suite/innodb/t/innodb-page_encryption_compression.opt3
-rw-r--r--mysql-test/suite/innodb/t/innodb-page_encryption_compression.test116
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug14147491.test2
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug60049.test1
-rw-r--r--mysql-test/suite/innodb/t/innodb_corrupt_bit.opt1
-rw-r--r--mysql-test/suite/innodb/t/innodb_encryption.opt8
-rw-r--r--mysql-test/suite/innodb/t/innodb_encryption.test175
-rw-r--r--mysql-test/suite/innodb/t/innodb_information_schema.test7
-rw-r--r--mysql-test/suite/innodb/t/innodb_information_schema_buffer.test5
-rw-r--r--mysql-test/suite/innodb/t/innodb_scrub.opt14
-rw-r--r--mysql-test/suite/innodb/t/innodb_scrub.test154
-rw-r--r--mysql-test/suite/innodb/t/innodb_scrub_background.opt15
-rw-r--r--mysql-test/suite/innodb/t/innodb_scrub_background.test168
-rw-r--r--mysql-test/suite/innodb/t/innodb_scrub_compressed.opt15
-rw-r--r--mysql-test/suite/innodb/t/innodb_scrub_compressed.test159
-rw-r--r--mysql-test/suite/innodb_zip/t/innodb_cmp_drop_table.test4
-rw-r--r--mysql-test/suite/maria/maria-recovery3.result2
-rw-r--r--mysql-test/suite/maria/maria3.result1
-rw-r--r--mysql-test/suite/sys_vars/r/aria_encrypt_tables_basic.result41
-rw-r--r--mysql-test/suite/sys_vars/r/debug_use_static_encryption_keys_basic.result3
-rw-r--r--mysql-test/suite/sys_vars/r/encrypt_tmp_disk_tables_basic.result41
-rw-r--r--mysql-test/suite/sys_vars/r/encryption_algorithm_basic.result7
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_background_scrub_data_check_interval_basic.result72
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_background_scrub_data_compressed_basic.result50
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_background_scrub_data_interval_basic.result50
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_background_scrub_data_uncompressed_basic.result50
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_data_encryption_filekey_basic.result9
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_data_encryption_providername_basic.result9
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_data_encryption_providertype_basic.result11
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_data_encryption_providerurl_basic.result9
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_encrypt_log_basic.result48
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_encrypt_tables_basic.result41
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_encryption_rotate_key_age_basic.result41
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_encryption_rotation_iops_basic.result41
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_encryption_threads_basic.result41
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_immediate_scrub_data_uncompressed_basic.result50
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_monitor_disable_basic.result3
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_monitor_enable_basic.result3
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_monitor_reset_all_basic.result3
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_monitor_reset_basic.result3
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_scrub_force_testing_basic.result50
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_scrub_log_basic.result48
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_scrub_log_interval_basic.result53
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_aria.result14
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_debug.result28
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_innodb.result182
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_server_embedded.result28
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result28
-rw-r--r--mysql-test/suite/sys_vars/t/aria_encrypt_tables_basic.test41
-rw-r--r--mysql-test/suite/sys_vars/t/debug_encryption_key_version_basic.test3
-rw-r--r--mysql-test/suite/sys_vars/t/debug_use_static_encryption_keys_basic.test3
-rw-r--r--mysql-test/suite/sys_vars/t/encrypt_tmp_disk_tables_basic.test41
-rw-r--r--mysql-test/suite/sys_vars/t/encryption_algorithm_basic.test13
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_background_scrub_data_check_interval_basic.test54
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_background_scrub_data_compressed_basic.test41
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_background_scrub_data_interval_basic.test41
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_background_scrub_data_uncompressed_basic.test41
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_checksum_algorithm_basic.test1
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_data_encryption_filekey_basic.test14
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_data_encryption_providername_basic.test11
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_data_encryption_providertype_basic.test16
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_data_encryption_providerurl_basic.test14
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_encrypt_log_basic.test50
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_encrypt_tables_basic.test41
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_encryption_rotate_key_age_basic.test41
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_encryption_rotation_iops_basic.test41
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_encryption_threads_basic.test41
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_immediate_scrub_data_uncompressed_basic.test41
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_scrub_force_testing_basic.test42
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_scrub_log_basic.test50
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_scrub_log_interval_basic.test55
-rw-r--r--mysql-test/t/information_schema_all_engines-master.opt2
-rw-r--r--mysql-test/t/mysqld--help.test3
92 files changed, 3718 insertions, 5 deletions
diff --git a/mysql-test/include/have_innodb_encryption.inc b/mysql-test/include/have_innodb_encryption.inc
new file mode 100644
index 00000000000..f81d1527d50
--- /dev/null
+++ b/mysql-test/include/have_innodb_encryption.inc
@@ -0,0 +1,7 @@
+#
+# Ensure we have innodb encryption incompiled
+
+if (`select count(*)=0 from information_schema.global_variables where variable_name="innodb_data_encryption_providertype"`)
+{
+ --skip Test requires InnoDB encryption.
+}
diff --git a/mysql-test/include/maria_verify_recovery.inc b/mysql-test/include/maria_verify_recovery.inc
index 9b56061b2b4..b0f95d2a94b 100644
--- a/mysql-test/include/maria_verify_recovery.inc
+++ b/mysql-test/include/maria_verify_recovery.inc
@@ -78,6 +78,8 @@ let $mms_purpose=comparison;
let $mms_compare_physically=$mms_compare_physically_save;
while ($mms_table_to_use)
{
+ # the size of the index file is different for with/without encryption
+ --replace_result 372 <SIZE> 394 <SIZE>
eval check table $mms_tname$mms_table_to_use extended;
--echo * testing that checksum after recovery is as expected
let $new_checksum=`CHECKSUM TABLE $mms_tname$mms_table_to_use`;
diff --git a/mysql-test/include/not_encrypted.inc b/mysql-test/include/not_encrypted.inc
new file mode 100644
index 00000000000..2702fb3d8f0
--- /dev/null
+++ b/mysql-test/include/not_encrypted.inc
@@ -0,0 +1,4 @@
+if (`select @@innodb_encrypt_tables = 1`)
+{
+ skip only without encryption;
+}
diff --git a/mysql-test/include/restart_mysqld.inc b/mysql-test/include/restart_mysqld.inc
index 3d53fada870..b8625f2f18a 100644
--- a/mysql-test/include/restart_mysqld.inc
+++ b/mysql-test/include/restart_mysqld.inc
@@ -19,7 +19,14 @@ if ($rpl_inited)
shutdown_server 60;
# Write file to make mysql-test-run.pl start up the server again
---exec echo "restart" > $_expect_file_name
+if ($restart_parameters)
+{
+ --exec echo "restart: $restart_parameters" > $_expect_file_name
+}
+if (!$restart_parameters)
+{
+ --exec echo "restart" > $_expect_file_name
+}
# Turn on reconnect
--enable_reconnect
diff --git a/mysql-test/r/information_schema_all_engines.result b/mysql-test/r/information_schema_all_engines.result
index 2abecfa346f..7b3e3a5f328 100644
--- a/mysql-test/r/information_schema_all_engines.result
+++ b/mysql-test/r/information_schema_all_engines.result
@@ -31,6 +31,8 @@ INNODB_SYS_FOREIGN_COLS
INNODB_SYS_INDEXES
INNODB_SYS_TABLES
INNODB_SYS_TABLESTATS
+INNODB_TABLESPACES_ENCRYPTION
+INNODB_TABLESPACES_SCRUBBING
INNODB_TRX
KEY_CACHES
KEY_COLUMN_USAGE
@@ -102,6 +104,8 @@ INNODB_SYS_FOREIGN_COLS ID
INNODB_SYS_INDEXES INDEX_ID
INNODB_SYS_TABLES TABLE_ID
INNODB_SYS_TABLESTATS TABLE_ID
+INNODB_TABLESPACES_ENCRYPTION SPACE
+INNODB_TABLESPACES_SCRUBBING SPACE
INNODB_TRX trx_id
KEY_CACHES KEY_CACHE_NAME
KEY_COLUMN_USAGE CONSTRAINT_SCHEMA
@@ -173,6 +177,8 @@ INNODB_SYS_FOREIGN_COLS ID
INNODB_SYS_INDEXES INDEX_ID
INNODB_SYS_TABLES TABLE_ID
INNODB_SYS_TABLESTATS TABLE_ID
+INNODB_TABLESPACES_ENCRYPTION SPACE
+INNODB_TABLESPACES_SCRUBBING SPACE
INNODB_TRX trx_id
KEY_CACHES KEY_CACHE_NAME
KEY_COLUMN_USAGE CONSTRAINT_SCHEMA
@@ -249,6 +255,8 @@ INNODB_SYS_FOREIGN_COLS information_schema.INNODB_SYS_FOREIGN_COLS 1
INNODB_SYS_INDEXES information_schema.INNODB_SYS_INDEXES 1
INNODB_SYS_TABLES information_schema.INNODB_SYS_TABLES 1
INNODB_SYS_TABLESTATS information_schema.INNODB_SYS_TABLESTATS 1
+INNODB_TABLESPACES_ENCRYPTION information_schema.INNODB_TABLESPACES_ENCRYPTION 1
+INNODB_TABLESPACES_SCRUBBING information_schema.INNODB_TABLESPACES_SCRUBBING 1
INNODB_TRX information_schema.INNODB_TRX 1
KEY_CACHES information_schema.KEY_CACHES 1
KEY_COLUMN_USAGE information_schema.KEY_COLUMN_USAGE 1
@@ -310,6 +318,8 @@ Database: information_schema
| INNODB_SYS_INDEXES |
| INNODB_SYS_TABLES |
| INNODB_SYS_TABLESTATS |
+| INNODB_TABLESPACES_ENCRYPTION |
+| INNODB_TABLESPACES_SCRUBBING |
| INNODB_TRX |
| KEY_CACHES |
| KEY_COLUMN_USAGE |
@@ -371,6 +381,8 @@ Database: INFORMATION_SCHEMA
| INNODB_SYS_INDEXES |
| INNODB_SYS_TABLES |
| INNODB_SYS_TABLESTATS |
+| INNODB_TABLESPACES_ENCRYPTION |
+| INNODB_TABLESPACES_SCRUBBING |
| INNODB_TRX |
| KEY_CACHES |
| KEY_COLUMN_USAGE |
@@ -405,5 +417,5 @@ Wildcard: inf_rmation_schema
| information_schema |
SELECT table_schema, count(*) FROM information_schema.TABLES WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test', 'mysqltest') GROUP BY TABLE_SCHEMA;
table_schema count(*)
-information_schema 56
+information_schema 59
mysql 30
diff --git a/mysql-test/r/mysqld--help.result b/mysql-test/r/mysqld--help.result
index ce1198a994a..1a6897d4de2 100644
--- a/mysql-test/r/mysqld--help.result
+++ b/mysql-test/r/mysqld--help.result
@@ -162,6 +162,13 @@ The following options may be given as the first argument:
--div-precision-increment=#
Precision of the result of '/' operator will be increased
on that value
+ --encrypt-tmp-disk-tables
+ Encrypt tmp disk tables (created as part of query
+ execution)
+ --encryption-algorithm=name
+ Which encryption algorithm to use for table encryption.
+ aes_cbc is the recommended one.. One of: none, aes_ecb,
+ aes_cbc, aes_ctr
--event-scheduler[=name]
Enable the event scheduler. Possible values are ON, OFF,
and DISABLED (keep the event scheduler completely
@@ -1141,6 +1148,8 @@ delayed-insert-limit 100
delayed-insert-timeout 300
delayed-queue-size 1000
div-precision-increment 4
+encrypt-tmp-disk-tables FALSE
+encryption-algorithm none
event-scheduler OFF
expensive-subquery-limit 100
expire-logs-days 0
diff --git a/mysql-test/suite/funcs_1/r/is_engines_innodb.result b/mysql-test/suite/funcs_1/r/is_engines_innodb.result
index 5713b417cd1..b8c6399fe94 100644
--- a/mysql-test/suite/funcs_1/r/is_engines_innodb.result
+++ b/mysql-test/suite/funcs_1/r/is_engines_innodb.result
@@ -2,7 +2,7 @@ SELECT * FROM information_schema.engines
WHERE ENGINE = 'InnoDB';
ENGINE InnoDB
SUPPORT YES
-COMMENT Supports transactions, row-level locking, and foreign keys
+COMMENT Supports transactions, row-level locking, foreign keys and encryption for tables
TRANSACTIONS YES
XA YES
SAVEPOINTS YES
diff --git a/mysql-test/suite/innodb/include/keys.txt b/mysql-test/suite/innodb/include/keys.txt
new file mode 100644
index 00000000000..419b76f698f
--- /dev/null
+++ b/mysql-test/suite/innodb/include/keys.txt
@@ -0,0 +1,6 @@
+1;F5502320F8429037B8DAEF761B189D12;770A8A65DA156D24EE2A093277530142
+2;35B2FF0795FB84BBD666DB8430CA214E;4D92199549E0F2EF009B4160F3582E5528A11A45017F3EF8
+3;7E892875A52C59A3B588306B13C31FBD;B374A26A71490437AA024E4FADD5B497FDFF1A8EA6FF12F6FB65AF2720B59CCF
+4;021B0663D4DD7B54E2EBC852677E40BD;18420B5CBA31CCDFFE9716E91EB61374D05914F3ADE23E03
+5;9BF92CEA026CE732DA80821122A8CE97;966050D7777350B6FD5CCB3E5F648DA45C63BEFB6DEDDFA13443F156B7D35C84
+6;BC44D4AFD2D9FCD82A679E4DC6700D06;B5EA210C8C09EF20DB95EC584714A89F
diff --git a/mysql-test/suite/innodb/r/innodb-page_encryption.result b/mysql-test/suite/innodb/r/innodb-page_encryption.result
new file mode 100644
index 00000000000..79902d0abe8
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb-page_encryption.result
@@ -0,0 +1,186 @@
+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 page_encryption=1 page_encryption_key=1;
+create table innodb_compressed(c1 bigint not null, b char(200)) engine=innodb row_format=compressed page_encryption=1 page_encryption_key=2;
+create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic page_encryption=1 page_encryption_key=3;
+create table innodb_redundant(c1 bigint not null, b char(200)) engine=innodb row_format=redundant page_encryption=1 page_encryption_key=4;
+show create table innodb_compact;
+Table Create Table
+innodb_compact CREATE TABLE `innodb_compact` (
+ `c1` bigint(20) NOT NULL,
+ `b` char(200) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT `page_encryption`=1 `page_encryption_key`=1
+show create table innodb_compressed;
+Table Create Table
+innodb_compressed CREATE TABLE `innodb_compressed` (
+ `c1` bigint(20) NOT NULL,
+ `b` char(200) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED `page_encryption`=1 `page_encryption_key`=2
+show create table innodb_dynamic;
+Table Create Table
+innodb_dynamic CREATE TABLE `innodb_dynamic` (
+ `c1` bigint(20) NOT NULL,
+ `b` char(200) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC `page_encryption`=1 `page_encryption_key`=3
+show create table innodb_redundant;
+Table Create Table
+innodb_redundant CREATE TABLE `innodb_redundant` (
+ `c1` bigint(20) NOT NULL,
+ `b` char(200) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT `page_encryption`=1 `page_encryption_key`=4
+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 innodb_normal values(current_num, substring(MD5(RAND()), -64));
+set current_num = current_num + 1;
+end while;
+end//
+commit;
+set autocommit=0;
+call innodb_insert_proc(5000);
+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;
+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;
+count(*)
+5000
+select count(*) from innodb_compressed where c1 < 1500000;
+count(*)
+5000
+select count(*) from innodb_dynamic where c1 < 1500000;
+count(*)
+5000
+select count(*) from innodb_redundant where c1 < 1500000;
+count(*)
+5000
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_encrypted';
+variable_value >= 0
+1
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_decrypted';
+variable_value >= 0
+1
+SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_encryption_error';
+variable_value = 0
+1
+SET GLOBAL innodb_file_format = `Barracuda`;
+SET GLOBAL innodb_file_per_table = ON;
+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;
+count(*)
+5000
+select count(*) from innodb_compressed where c1 < 1500000;
+count(*)
+5000
+select count(*) from innodb_dynamic where c1 < 1500000;
+count(*)
+5000
+select count(*) from innodb_redundant where c1 < 1500000;
+count(*)
+5000
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_encrypted';
+variable_value >= 0
+1
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_decrypted';
+variable_value >= 0
+1
+SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_encryption_error';
+variable_value = 0
+1
+alter table innodb_compact engine=innodb page_encryption=DEFAULT page_encryption_key=DEFAULT;
+show create table innodb_compact;
+Table Create Table
+innodb_compact CREATE TABLE `innodb_compact` (
+ `c1` bigint(20) NOT NULL,
+ `b` char(200) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT
+alter table innodb_compressed engine=innodb page_encryption=DEFAULT page_encryption_key=DEFAULT;
+show create table innodb_compressed;
+Table Create Table
+innodb_compressed CREATE TABLE `innodb_compressed` (
+ `c1` bigint(20) NOT NULL,
+ `b` char(200) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED
+alter table innodb_dynamic engine=innodb page_encryption=DEFAULT page_encryption_key=DEFAULT;
+show create table innodb_dynamic;
+Table Create Table
+innodb_dynamic CREATE TABLE `innodb_dynamic` (
+ `c1` bigint(20) NOT NULL,
+ `b` char(200) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
+alter table innodb_redundant engine=innodb page_encryption=DEFAULT page_encryption_key=DEFAULT;
+show create table innodb_redundant;
+Table Create Table
+innodb_redundant CREATE TABLE `innodb_redundant` (
+ `c1` bigint(20) NOT NULL,
+ `b` char(200) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT
+SET GLOBAL innodb_file_format = `Barracuda`;
+SET GLOBAL innodb_file_per_table = ON;
+show create table innodb_compact;
+Table Create Table
+innodb_compact CREATE TABLE `innodb_compact` (
+ `c1` bigint(20) NOT NULL,
+ `b` char(200) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT
+show create table innodb_compressed;
+Table Create Table
+innodb_compressed CREATE TABLE `innodb_compressed` (
+ `c1` bigint(20) NOT NULL,
+ `b` char(200) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED
+show create table innodb_dynamic;
+Table Create Table
+innodb_dynamic CREATE TABLE `innodb_dynamic` (
+ `c1` bigint(20) NOT NULL,
+ `b` char(200) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
+show create table innodb_redundant;
+Table Create Table
+innodb_redundant CREATE TABLE `innodb_redundant` (
+ `c1` bigint(20) NOT NULL,
+ `b` char(200) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT
+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;
+count(*)
+5000
+select count(*) from innodb_compressed where c1 < 1500000;
+count(*)
+5000
+select count(*) from innodb_dynamic where c1 < 1500000;
+count(*)
+5000
+select count(*) from innodb_redundant where c1 < 1500000;
+count(*)
+5000
+SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_encrypted';
+variable_value = 0
+1
+SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_decrypted';
+variable_value = 0
+1
+SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_encryption_error';
+variable_value = 0
+1
+drop procedure innodb_insert_proc;
+drop table innodb_normal;
+drop table innodb_compact;
+drop table innodb_compressed;
+drop table innodb_dynamic;
+drop table innodb_redundant;
diff --git a/mysql-test/suite/innodb/r/innodb-page_encryption_compression.result b/mysql-test/suite/innodb/r/innodb-page_encryption_compression.result
new file mode 100644
index 00000000000..a9494795814
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb-page_encryption_compression.result
@@ -0,0 +1,171 @@
+SET GLOBAL innodb_file_format = `Barracuda`;
+SET GLOBAL innodb_file_per_table = ON;
+set global innodb_compression_algorithm = 1;
+create table innodb_normal(c1 bigint not null, b char(200)) engine=innodb page_compressed=1;
+create table innodb_compact(c1 bigint not null, b char(200)) engine=innodb row_format=compact page_encryption=1 page_encryption_key=1 page_compressed=1;
+create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic page_encryption=1 page_encryption_key=2 page_compressed=1;
+show warnings;
+Level Code Message
+show create table innodb_normal;
+Table Create Table
+innodb_normal CREATE TABLE `innodb_normal` (
+ `c1` bigint(20) NOT NULL,
+ `b` char(200) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1
+show create table innodb_compact;
+Table Create Table
+innodb_compact CREATE TABLE `innodb_compact` (
+ `c1` bigint(20) NOT NULL,
+ `b` char(200) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT `page_encryption`=1 `page_encryption_key`=1 `page_compressed`=1
+show create table innodb_dynamic;
+Table Create Table
+innodb_dynamic CREATE TABLE `innodb_dynamic` (
+ `c1` bigint(20) NOT NULL,
+ `b` char(200) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC `page_encryption`=1 `page_encryption_key`=2 `page_compressed`=1
+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 innodb_normal values(current_num, substring(MD5(RAND()), -64));
+set current_num = current_num + 1;
+end while;
+end//
+commit;
+set autocommit=0;
+call innodb_insert_proc(5000);
+commit;
+set autocommit=1;
+insert into innodb_compact select * from innodb_normal;
+insert into innodb_dynamic select * from innodb_normal;
+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;
+count(*)
+5000
+select count(*) from innodb_compact where c1 < 1500000;
+count(*)
+5000
+select count(*) from innodb_dynamic where c1 < 1500000;
+count(*)
+5000
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_encrypted';
+variable_value >= 0
+1
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_decrypted';
+variable_value >= 0
+1
+SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_encryption_error';
+variable_value = 0
+1
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_compressed';
+variable_value >= 0
+1
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_decompressed';
+variable_value >= 0
+1
+SET GLOBAL innodb_file_format = `Barracuda`;
+SET GLOBAL innodb_file_per_table = ON;
+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;
+count(*)
+5000
+select count(*) from innodb_compact where c1 < 1500000;
+count(*)
+5000
+select count(*) from innodb_dynamic where c1 < 1500000;
+count(*)
+5000
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_encrypted';
+variable_value >= 0
+1
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_decrypted';
+variable_value >= 0
+1
+SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_encryption_error';
+variable_value = 0
+1
+SELECT variable_value > 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_compressed';
+variable_value > 0
+0
+SELECT variable_value > 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_decompressed';
+variable_value > 0
+1
+alter table innodb_normal engine=innodb page_compressed=DEFAULT;
+show create table innodb_normal;
+Table Create Table
+innodb_normal CREATE TABLE `innodb_normal` (
+ `c1` bigint(20) NOT NULL,
+ `b` char(200) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+alter table innodb_compact engine=innodb page_encryption=DEFAULT page_encryption_key=DEFAULT page_compressed=DEFAULT;
+show create table innodb_compact;
+Table Create Table
+innodb_compact CREATE TABLE `innodb_compact` (
+ `c1` bigint(20) NOT NULL,
+ `b` char(200) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT
+alter table innodb_dynamic engine=innodb page_encryption=DEFAULT page_encryption_key=DEFAULT page_compressed=DEFAULT;
+show create table innodb_dynamic;
+Table Create Table
+innodb_dynamic CREATE TABLE `innodb_dynamic` (
+ `c1` bigint(20) NOT NULL,
+ `b` char(200) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
+SET GLOBAL innodb_file_format = `Barracuda`;
+SET GLOBAL innodb_file_per_table = ON;
+show create table innodb_normal;
+Table Create Table
+innodb_normal CREATE TABLE `innodb_normal` (
+ `c1` bigint(20) NOT NULL,
+ `b` char(200) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+show create table innodb_compact;
+Table Create Table
+innodb_compact CREATE TABLE `innodb_compact` (
+ `c1` bigint(20) NOT NULL,
+ `b` char(200) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT
+show create table innodb_dynamic;
+Table Create Table
+innodb_dynamic CREATE TABLE `innodb_dynamic` (
+ `c1` bigint(20) NOT NULL,
+ `b` char(200) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=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;
+count(*)
+5000
+select count(*) from innodb_compact where c1 < 1500000;
+count(*)
+5000
+select count(*) from innodb_dynamic where c1 < 1500000;
+count(*)
+5000
+SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_encrypted';
+variable_value = 0
+1
+SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_decrypted';
+variable_value = 0
+1
+SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_encryption_error';
+variable_value = 0
+1
+SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_compressed';
+variable_value = 0
+1
+SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_decompressed';
+variable_value = 0
+1
+drop procedure innodb_insert_proc;
+drop table innodb_normal;
+drop table innodb_compact;
+drop table innodb_dynamic;
diff --git a/mysql-test/suite/innodb/r/innodb_encryption.result b/mysql-test/suite/innodb/r/innodb_encryption.result
new file mode 100644
index 00000000000..040cbd294f9
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb_encryption.result
@@ -0,0 +1,57 @@
+SET @start_global_value = @@global.innodb_encryption_threads;
+SHOW VARIABLES LIKE 'innodb_encrypt%';
+Variable_name Value
+innodb_encrypt_log OFF
+innodb_encrypt_tables ON
+innodb_encryption_rotate_key_age 15
+innodb_encryption_rotation_iops 100
+innodb_encryption_threads 4
+DESCRIBE INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION;
+Field Type Null Key Default Extra
+SPACE int(11) unsigned NO 0
+NAME varchar(655) YES NULL
+ENCRYPTION_SCHEME int(11) unsigned NO 0
+KEYSERVER_REQUESTS int(11) unsigned NO 0
+MIN_KEY_VERSION int(11) unsigned NO 0
+CURRENT_KEY_VERSION int(11) unsigned NO 0
+KEY_ROTATION_PAGE_NUMBER bigint(21) unsigned YES NULL
+KEY_ROTATION_MAX_PAGE_NUMBER bigint(21) unsigned YES NULL
+# Wait max 5 min for key encryption threads to encrypt one space
+# Success!
+# Wait max 10 min for key encryption threads to encrypt all space
+# Success!
+# Now turn off encryption and wait for threads to decrypt everything
+SET GLOBAL innodb_encrypt_tables = off;
+# Wait max 10 min for key encryption threads to decrypt all space
+# Success!
+# Shutdown innodb_encryption_threads
+SET GLOBAL innodb_encryption_threads=0;
+# Turn on encryption
+# since threads are off tables should remain unencrypted
+SET GLOBAL innodb_encrypt_tables = on;
+# Wait 15s to check that nothing gets encrypted
+# Success!
+# Startup innodb_encryption_threads
+SET GLOBAL innodb_encryption_threads=@start_global_value;
+# Wait 1 min to check that it start encrypting again
+# Success!
+#
+# Check that restart with encryption turned off works
+# even if spaces are encrypted
+#
+# First wait max 10 min for key encryption threads to encrypt all spaces
+# Success!
+# Restart mysqld --innodb_encrypt_tables=0 --innodb_encryption_threads=0
+SHOW VARIABLES LIKE 'innodb_encrypt%';
+Variable_name Value
+innodb_encrypt_log OFF
+innodb_encrypt_tables OFF
+innodb_encryption_rotate_key_age 15
+innodb_encryption_rotation_iops 100
+innodb_encryption_threads 0
+SELECT COUNT(*) > 0 as should_be_1
+FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION
+WHERE MIN_KEY_VERSION <> 0;
+should_be_1
+1
+# Restart mysqld again...with default options
diff --git a/mysql-test/suite/innodb/r/innodb_monitor.result b/mysql-test/suite/innodb/r/innodb_monitor.result
index 84668cf49d0..02e72ae6a80 100644
--- a/mysql-test/suite/innodb/r/innodb_monitor.result
+++ b/mysql-test/suite/innodb/r/innodb_monitor.result
@@ -180,6 +180,9 @@ compress_page_compressed_trim_op disabled
compress_page_compressed_trim_op_saved disabled
compress_pages_page_decompressed disabled
compress_pages_page_compression_error disabled
+compress_pages_page_encrypted disabled
+compress_pages_page_decrypted disabled
+compress_pages_page_encryption_error disabled
index_page_splits disabled
index_page_merge_attempts disabled
index_page_merge_successful disabled
diff --git a/mysql-test/suite/innodb/r/innodb_scrub.result b/mysql-test/suite/innodb/r/innodb_scrub.result
new file mode 100644
index 00000000000..95f0aed3226
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb_scrub.result
@@ -0,0 +1,224 @@
+create table snapshot_status engine = myisam
+select * from information_schema.global_status
+where variable_name like 'innodb_scrub%';
+#
+# Test delete of records
+#
+create table t1 (
+a int auto_increment primary key,
+b varchar(256),
+c text) engine = innodb row_format=compact;
+# Populate table with rows
+delete from t1;
+# restart mysqld so that all pages are flushed
+# read all rows from table
+select * from t1;
+# compact: delete from: grep -c bicycle t1.ibd
+0
+# compact: delete from: grep -c bicycle ibdata1
+0
+# compact: delete from: grep -c repairman t1.ibd
+0
+# compact: delete from: grep -c repairman ibdata1
+0
+drop table t1;
+#
+# Test delete+rollback+delete
+#
+create table t1 (
+a int auto_increment primary key,
+b varchar(256),
+c text) engine = innodb row_format=compact;
+# Populate table with rows
+begin;
+delete from t1;
+rollback;
+delete from t1;
+# restart mysqld so that all pages are flushed
+# read all rows from table
+select * from t1;
+# compact: delete rollback: grep -c bicycle t1.ibd
+0
+# compact: delete rollback: grep -c bicycle ibdata1
+0
+# compact: delete rollback: grep -c repairman t1.ibd
+0
+# compact: delete rollback: grep -c repairman ibdata1
+0
+drop table t1;
+#
+# Test insert+rollback
+#
+create table t1 (
+a int auto_increment primary key,
+b varchar(256),
+c text) engine = innodb row_format=compact;
+# Populate table with rows
+begin;
+rollback;
+# restart mysqld so that all pages are flushed
+# read all rows from table
+select * from t1;
+# compact: insert rollback: grep -c bicycle t1.ibd
+0
+# compact: insert rollback: grep -c bicycle ibdata1
+0
+# compact: insert rollback: grep -c repairman t1.ibd
+0
+# compact: insert rollback: grep -c repairman ibdata1
+0
+drop table t1;
+#
+# Test delete of records
+#
+create table t1 (
+a int auto_increment primary key,
+b varchar(256),
+c text) engine = innodb row_format=redundant;
+# Populate table with rows
+delete from t1;
+# restart mysqld so that all pages are flushed
+# read all rows from table
+select * from t1;
+# redundant: delete from: grep -c bicycle t1.ibd
+0
+# redundant: delete from: grep -c bicycle ibdata1
+0
+# redundant: delete from: grep -c repairman t1.ibd
+0
+# redundant: delete from: grep -c repairman ibdata1
+0
+drop table t1;
+#
+# Test delete+rollback+delete
+#
+create table t1 (
+a int auto_increment primary key,
+b varchar(256),
+c text) engine = innodb row_format=redundant;
+# Populate table with rows
+begin;
+delete from t1;
+rollback;
+delete from t1;
+# restart mysqld so that all pages are flushed
+# read all rows from table
+select * from t1;
+# redundant: delete rollback: grep -c bicycle t1.ibd
+0
+# redundant: delete rollback: grep -c bicycle ibdata1
+0
+# redundant: delete rollback: grep -c repairman t1.ibd
+0
+# redundant: delete rollback: grep -c repairman ibdata1
+0
+drop table t1;
+#
+# Test insert+rollback
+#
+create table t1 (
+a int auto_increment primary key,
+b varchar(256),
+c text) engine = innodb row_format=redundant;
+# Populate table with rows
+begin;
+rollback;
+# restart mysqld so that all pages are flushed
+# read all rows from table
+select * from t1;
+# redundant: insert rollback: grep -c bicycle t1.ibd
+0
+# redundant: insert rollback: grep -c bicycle ibdata1
+0
+# redundant: insert rollback: grep -c repairman t1.ibd
+0
+# redundant: insert rollback: grep -c repairman ibdata1
+0
+drop table t1;
+#
+# Test delete of records
+#
+create table t1 (
+a int auto_increment primary key,
+b varchar(256),
+c text) engine = innodb row_format=dynamic;
+# Populate table with rows
+delete from t1;
+# restart mysqld so that all pages are flushed
+# read all rows from table
+select * from t1;
+# dynamic: delete from: grep -c bicycle t1.ibd
+0
+# dynamic: delete from: grep -c bicycle ibdata1
+0
+# dynamic: delete from: grep -c repairman t1.ibd
+0
+# dynamic: delete from: grep -c repairman ibdata1
+0
+drop table t1;
+#
+# Test delete+rollback+delete
+#
+create table t1 (
+a int auto_increment primary key,
+b varchar(256),
+c text) engine = innodb row_format=dynamic;
+# Populate table with rows
+begin;
+delete from t1;
+rollback;
+delete from t1;
+# restart mysqld so that all pages are flushed
+# read all rows from table
+select * from t1;
+# dynamic: delete rollback: grep -c bicycle t1.ibd
+0
+# dynamic: delete rollback: grep -c bicycle ibdata1
+0
+# dynamic: delete rollback: grep -c repairman t1.ibd
+0
+# dynamic: delete rollback: grep -c repairman ibdata1
+0
+drop table t1;
+#
+# Test insert+rollback
+#
+create table t1 (
+a int auto_increment primary key,
+b varchar(256),
+c text) engine = innodb row_format=dynamic;
+# Populate table with rows
+begin;
+rollback;
+# restart mysqld so that all pages are flushed
+# read all rows from table
+select * from t1;
+# dynamic: insert rollback: grep -c bicycle t1.ibd
+0
+# dynamic: insert rollback: grep -c bicycle ibdata1
+0
+# dynamic: insert rollback: grep -c repairman t1.ibd
+0
+# dynamic: insert rollback: grep -c repairman ibdata1
+0
+drop table t1;
+show variables like 'innodb_%scrub_data%';
+Variable_name Value
+innodb_background_scrub_data_check_interval 3600
+innodb_background_scrub_data_compressed OFF
+innodb_background_scrub_data_interval 604800
+innodb_background_scrub_data_uncompressed OFF
+innodb_immediate_scrub_data_uncompressed ON
+# verify that this test have not caused any background scrubbing
+select ss.variable_name, gs.variable_value - ss.variable_value as variable_value
+from snapshot_status ss,
+information_schema.global_status gs
+where ss.variable_name = gs.variable_name;
+variable_name variable_value
+INNODB_SCRUB_BACKGROUND_PAGE_REORGANIZATIONS 0
+INNODB_SCRUB_BACKGROUND_PAGE_SPLITS 0
+INNODB_SCRUB_BACKGROUND_PAGE_SPLIT_FAILURES_MISSING_INDEX 0
+INNODB_SCRUB_BACKGROUND_PAGE_SPLIT_FAILURES_OUT_OF_FILESPACE 0
+INNODB_SCRUB_BACKGROUND_PAGE_SPLIT_FAILURES_UNDERFLOW 0
+INNODB_SCRUB_BACKGROUND_PAGE_SPLIT_FAILURES_UNKNOWN 0
+drop table snapshot_status;
diff --git a/mysql-test/suite/innodb/r/innodb_scrub_background.result b/mysql-test/suite/innodb/r/innodb_scrub_background.result
new file mode 100644
index 00000000000..cd7416efedd
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb_scrub_background.result
@@ -0,0 +1,88 @@
+#
+# immediate scrubbing is off
+# background scrubbing is on
+#
+show variables like 'innodb_%scrub_data%';
+Variable_name Value
+innodb_background_scrub_data_check_interval 3600
+innodb_background_scrub_data_compressed ON
+innodb_background_scrub_data_interval 604800
+innodb_background_scrub_data_uncompressed ON
+innodb_immediate_scrub_data_uncompressed OFF
+# make sure spaces are checked quickly
+SET GLOBAL innodb_background_scrub_data_check_interval=1;
+create table snapshot_status engine = myisam
+select * from information_schema.global_status
+where variable_name like 'innodb_scrub%';
+truncate table snapshot_status;
+insert into snapshot_status
+select * from information_schema.global_status
+where variable_name like 'innodb_scrub%';
+#
+# Test delete of records
+#
+create table t1 (
+a int auto_increment primary key,
+b varchar(256),
+c text, index(b)) engine = innodb row_format=dynamic;
+# Populate table with rows
+delete from t1;
+#
+# Test delete+rollback+delete
+#
+create table t2 (
+a int auto_increment primary key,
+b varchar(256),
+c text, index(b)) engine = innodb row_format=dynamic;
+# Populate table with rows
+begin;
+delete from t2;
+rollback;
+delete from t2;
+#
+# Test insert+rollback
+#
+create table t3 (
+a int auto_increment primary key,
+b varchar(256),
+c text, index(b)) engine = innodb row_format=dynamic;
+# Populate table with rows
+begin;
+rollback;
+# start scrubbing threads
+SET GLOBAL innodb_encryption_threads=5;
+# Wait max 10 min for scrubbing
+# Success!
+# stop scrubbing threads
+SET GLOBAL innodb_encryption_threads=0;
+# verify that this test have caused background scrubbing
+select sum(gs.variable_value - ss.variable_value) > 0 as should_be_1
+from snapshot_status ss,
+information_schema.global_status gs
+where ss.variable_name = gs.variable_name;
+should_be_1
+1
+# restart mysqld so that all pages are flushed
+# read all rows from table
+select * from t1;
+# dynamic: delete: grep -c bicycle t1.ibd
+0
+# dynamic: delete: grep -c repairman t1.ibd
+0
+# dynamic: delete rollback: grep -c bicycle t2.ibd
+0
+# dynamic: delete rollback: grep -c repairman t2.ibd
+0
+# dynamic: insert rollback: grep -c bicycle t3.ibd
+0
+# dynamic: insert rollback: grep -c repairman t3.ibd
+0
+drop table t1, t2, t3;
+show variables like 'innodb_%scrub_data%';
+Variable_name Value
+innodb_background_scrub_data_check_interval 3600
+innodb_background_scrub_data_compressed ON
+innodb_background_scrub_data_interval 604800
+innodb_background_scrub_data_uncompressed ON
+innodb_immediate_scrub_data_uncompressed OFF
+drop table snapshot_status;
diff --git a/mysql-test/suite/innodb/r/innodb_scrub_compressed.result b/mysql-test/suite/innodb/r/innodb_scrub_compressed.result
new file mode 100644
index 00000000000..0b5e9f11a05
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb_scrub_compressed.result
@@ -0,0 +1,71 @@
+# make sure spaces are checked quickly
+SET GLOBAL innodb_background_scrub_data_check_interval=1;
+#
+# Test delete of records
+#
+create table t1 (
+a int auto_increment primary key,
+b varchar(256),
+c text) engine = innodb row_format=compressed;
+# Populate table with rows
+delete from t1;
+#
+# Test delete+rollback+delete
+#
+create table t2 (
+a int auto_increment primary key,
+b varchar(256),
+c text) engine = innodb row_format=compressed;
+# Populate table with rows
+begin;
+delete from t2;
+rollback;
+delete from t2;
+#
+# Test insert+rollback
+#
+create table t3 (
+a int auto_increment primary key,
+b varchar(256),
+c text) engine = innodb row_format=compressed;
+# Populate table with rows
+begin;
+rollback;
+# start scrubbing threads
+SET GLOBAL innodb_encryption_threads=5;
+# Wait max 10 min for scrubbing of this table
+# Success!
+# stop scrubbing threads
+SET GLOBAL innodb_encryption_threads=0;
+# Now there should be background scrubs
+# restart mysqld so that all pages are flushed (encryption off)
+# so that grep will find stuff
+# read all rows from table
+select * from t1;
+select * from t2;
+select * from t3;
+# grep -c bicycle t1.ibd
+0
+# grep -c bicycle ibdata1
+0
+# grep -c repairman t1.ibd
+0
+# grep -c repairman ibdata1
+0
+# grep -c boondoggle t2.ibd
+0
+# grep -c boondoggle ibdata1
+0
+# grep -c waste t2.ibd
+0
+# grep -c waste ibdata1
+0
+# grep -c keso t3.ibd
+0
+# grep -c keso ibdata1
+0
+# grep -c kent t3.ibd
+0
+# grep -c kent ibdata1
+0
+drop table t1, t2, t3;
diff --git a/mysql-test/suite/innodb/t/innodb-page_encryption-32k-master.opt b/mysql-test/suite/innodb/t/innodb-page_encryption-32k-master.opt
new file mode 100644
index 00000000000..723c0b360fd
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb-page_encryption-32k-master.opt
@@ -0,0 +1,4 @@
+--default-storage-engine=InnoDB
+--encryption-algorithm=aes_cbs
+--file-key-management-plugin-filename=$MYSQL_TEST_DIR/suite/innodb/include/keys.txt
+--innodb-buffer-pool-size=24M
diff --git a/mysql-test/suite/innodb/t/innodb-page_encryption-32k.test b/mysql-test/suite/innodb/t/innodb-page_encryption-32k.test
new file mode 100644
index 00000000000..e96e352da12
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb-page_encryption-32k.test
@@ -0,0 +1,94 @@
+--source include/no_valgrind_without_big.inc
+# Tests for setting innodb-page-size=32k;
+--source include/have_xtradb.inc
+--source include/have_innodb_32k.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 page_encryption=1 page_encryption_key=1;
+create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic page_encryption=1 page_encryption_key=3;
+create table innodb_redundant(c1 bigint not null, b char(200)) engine=innodb row_format=redundant page_encryption=1 page_encryption_key=4;
+
+show create table innodb_compact;
+show create table innodb_dynamic;
+show create table innodb_redundant;
+
+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 innodb_normal values(current_num, substring(MD5(RAND()), -150));
+ set current_num = current_num + 1;
+ end while;
+end//
+delimiter ;//
+commit;
+
+set autocommit=0;
+call innodb_insert_proc(5000);
+commit;
+set autocommit=1;
+
+insert into innodb_compact select * from innodb_normal;
+insert into innodb_dynamic select * from innodb_normal;
+insert into innodb_redundant select * from innodb_normal;
+
+update innodb_compact 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_dynamic where c1 < 1500000;
+select count(*) from innodb_redundant where c1 < 1500000;
+
+--source include/restart_mysqld.inc
+
+update innodb_compact 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_dynamic where c1 < 1500000;
+select count(*) from innodb_redundant where c1 < 1500000;
+
+alter table innodb_compact engine=innodb page_encryption=0;
+show create table innodb_compact;
+alter table innodb_dynamic engine=innodb page_encryption=0;
+show create table innodb_dynamic;
+alter table innodb_redundant engine=innodb page_encryption=0;
+show create table innodb_redundant;
+
+--source include/restart_mysqld.inc
+
+show create table innodb_compact;
+show create table innodb_dynamic;
+show create table innodb_redundant;
+
+update innodb_compact 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_dynamic where c1 < 1500000;
+select count(*) from innodb_redundant where c1 < 1500000;
+
+drop procedure innodb_insert_proc;
+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/innodb/t/innodb-page_encryption.opt b/mysql-test/suite/innodb/t/innodb-page_encryption.opt
new file mode 100644
index 00000000000..f3aa00059a8
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb-page_encryption.opt
@@ -0,0 +1,3 @@
+--enable-file-key-management-plugin
+--encryption-algorithm=aes_cbs
+--file-key-management-plugin-filename=$MYSQL_TEST_DIR/suite/innodb/include/keys.txt
diff --git a/mysql-test/suite/innodb/t/innodb-page_encryption.test b/mysql-test/suite/innodb/t/innodb-page_encryption.test
new file mode 100644
index 00000000000..a3ba64c5d48
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb-page_encryption.test
@@ -0,0 +1,121 @@
+-- source include/have_innodb.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 page_encryption=1 page_encryption_key=1;
+create table innodb_compressed(c1 bigint not null, b char(200)) engine=innodb row_format=compressed page_encryption=1 page_encryption_key=2;
+create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic page_encryption=1 page_encryption_key=3;
+create table innodb_redundant(c1 bigint not null, b char(200)) engine=innodb row_format=redundant page_encryption=1 page_encryption_key=4;
+
+show create table innodb_compact;
+show create table innodb_compressed;
+show create table innodb_dynamic;
+show create table innodb_redundant;
+
+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 innodb_normal values(current_num, substring(MD5(RAND()), -64));
+ set current_num = current_num + 1;
+ end while;
+end//
+delimiter ;//
+commit;
+
+set autocommit=0;
+call innodb_insert_proc(5000);
+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;
+
+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;
+
+# 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 LOWER(variable_name) = 'innodb_num_pages_page_encrypted';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_decrypted';
+SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_encryption_error';
+
+--source include/restart_mysqld.inc
+
+SET GLOBAL innodb_file_format = `Barracuda`;
+SET GLOBAL innodb_file_per_table = ON;
+
+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 variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_encrypted';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_decrypted';
+SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_encryption_error';
+
+alter table innodb_compact engine=innodb page_encryption=DEFAULT page_encryption_key=DEFAULT;
+show create table innodb_compact;
+alter table innodb_compressed engine=innodb page_encryption=DEFAULT page_encryption_key=DEFAULT;
+show create table innodb_compressed;
+alter table innodb_dynamic engine=innodb page_encryption=DEFAULT page_encryption_key=DEFAULT;
+show create table innodb_dynamic;
+alter table innodb_redundant engine=innodb page_encryption=DEFAULT page_encryption_key=DEFAULT;
+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;
+show create table innodb_redundant;
+
+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;
+
+# After alter+restart these should be 0
+SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_encrypted';
+SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_decrypted';
+SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_encryption_error';
+
+drop procedure innodb_insert_proc;
+drop table innodb_normal;
+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/innodb/t/innodb-page_encryption_compression.opt b/mysql-test/suite/innodb/t/innodb-page_encryption_compression.opt
new file mode 100644
index 00000000000..f3aa00059a8
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb-page_encryption_compression.opt
@@ -0,0 +1,3 @@
+--enable-file-key-management-plugin
+--encryption-algorithm=aes_cbs
+--file-key-management-plugin-filename=$MYSQL_TEST_DIR/suite/innodb/include/keys.txt
diff --git a/mysql-test/suite/innodb/t/innodb-page_encryption_compression.test b/mysql-test/suite/innodb/t/innodb-page_encryption_compression.test
new file mode 100644
index 00000000000..c07a03a1e37
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb-page_encryption_compression.test
@@ -0,0 +1,116 @@
+-- source include/have_innodb.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`;
+--enable_query_log
+
+SET GLOBAL innodb_file_format = `Barracuda`;
+SET GLOBAL innodb_file_per_table = ON;
+# zlib
+set global innodb_compression_algorithm = 1;
+
+create table innodb_normal(c1 bigint not null, b char(200)) engine=innodb page_compressed=1;
+create table innodb_compact(c1 bigint not null, b char(200)) engine=innodb row_format=compact page_encryption=1 page_encryption_key=1 page_compressed=1;
+create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic page_encryption=1 page_encryption_key=2 page_compressed=1;
+show warnings;
+
+show create table innodb_normal;
+show create table innodb_compact;
+show create table innodb_dynamic;
+
+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 innodb_normal values(current_num, substring(MD5(RAND()), -64));
+ set current_num = current_num + 1;
+ end while;
+end//
+delimiter ;//
+commit;
+
+set autocommit=0;
+call innodb_insert_proc(5000);
+commit;
+set autocommit=1;
+
+insert into innodb_compact select * from innodb_normal;
+insert into innodb_dynamic select * from innodb_normal;
+
+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 variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_encrypted';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_decrypted';
+SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_encryption_error';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_compressed';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_decompressed';
+
+--source include/restart_mysqld.inc
+
+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 variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_encrypted';
+SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_decrypted';
+SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_encryption_error';
+SELECT variable_value > 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_compressed';
+SELECT variable_value > 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_decompressed';
+
+alter table innodb_normal engine=innodb page_compressed=DEFAULT;
+show create table innodb_normal;
+alter table innodb_compact engine=innodb page_encryption=DEFAULT page_encryption_key=DEFAULT page_compressed=DEFAULT;
+show create table innodb_compact;
+alter table innodb_dynamic engine=innodb page_encryption=DEFAULT page_encryption_key=DEFAULT page_compressed=DEFAULT;
+show create table innodb_dynamic;
+
+--source include/restart_mysqld.inc
+
+SET GLOBAL innodb_file_format = `Barracuda`;
+SET GLOBAL innodb_file_per_table = ON;
+
+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 variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_encrypted';
+SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_decrypted';
+SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_encryption_error';
+SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_compressed';
+SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_decompressed';
+
+drop procedure innodb_insert_proc;
+drop table innodb_normal;
+drop table innodb_compact;
+drop table innodb_dynamic;
+
+# 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/innodb/t/innodb_bug14147491.test b/mysql-test/suite/innodb/t/innodb_bug14147491.test
index 6f0bfca8e1d..ee9bb4814bc 100644
--- a/mysql-test/suite/innodb/t/innodb_bug14147491.test
+++ b/mysql-test/suite/innodb/t/innodb_bug14147491.test
@@ -2,6 +2,8 @@
# Test opening a corrupted table.
#
+-- source include/not_encrypted.inc
+
# Don't test under valgrind, memory leaks will occur
source include/not_valgrind.inc;
# Avoid CrashReporter popup on Mac
diff --git a/mysql-test/suite/innodb/t/innodb_bug60049.test b/mysql-test/suite/innodb/t/innodb_bug60049.test
index 6760d1a1f02..b1d56d16a5e 100644
--- a/mysql-test/suite/innodb/t/innodb_bug60049.test
+++ b/mysql-test/suite/innodb/t/innodb_bug60049.test
@@ -5,6 +5,7 @@
-- source include/not_embedded.inc
-- source include/have_innodb.inc
-- source include/have_innodb_16k.inc
+-- source include/not_encrypted.inc
call mtr.add_suppression('InnoDB: Error: Table "mysql"."innodb_(table|index)_stats" not found');
call mtr.add_suppression('InnoDB: Error: Fetch of persistent statistics requested');
diff --git a/mysql-test/suite/innodb/t/innodb_corrupt_bit.opt b/mysql-test/suite/innodb/t/innodb_corrupt_bit.opt
new file mode 100644
index 00000000000..683a276da2a
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_corrupt_bit.opt
@@ -0,0 +1 @@
+--innodb-encryption-threads=0
diff --git a/mysql-test/suite/innodb/t/innodb_encryption.opt b/mysql-test/suite/innodb/t/innodb_encryption.opt
new file mode 100644
index 00000000000..e2fc72eb5a8
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_encryption.opt
@@ -0,0 +1,8 @@
+--enable-example-key-management-plugin
+--encrypt-tmp-disk-tables=ON
+--aria-encrypt-tables=ON
+--innodb-encryption-threads=4
+--innodb-encryption-rotate-key-age=15
+--innodb-encrypt-tables=ON
+--innodb-tablespaces-encryption
+--encryption-algorithm=aes_ctr
diff --git a/mysql-test/suite/innodb/t/innodb_encryption.test b/mysql-test/suite/innodb/t/innodb_encryption.test
new file mode 100644
index 00000000000..ffd57e47c01
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_encryption.test
@@ -0,0 +1,175 @@
+#
+#
+#
+-- source include/have_innodb.inc
+
+# embedded does not support restart
+-- source include/not_embedded.inc
+
+SET @start_global_value = @@global.innodb_encryption_threads;
+
+SHOW VARIABLES LIKE 'innodb_encrypt%';
+
+DESCRIBE INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION;
+
+--echo # Wait max 5 min for key encryption threads to encrypt one space
+let $cnt=300;
+while ($cnt)
+{
+ let $success=`SELECT COUNT(*) > 0 FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION > 0`;
+ if ($success)
+ {
+ let $cnt=0;
+ }
+ if (!$success)
+ {
+ real_sleep 1;
+ dec $cnt;
+ }
+}
+if (!$success)
+{
+ SELECT * FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION;
+ SHOW STATUS LIKE 'innodb_encryption%';
+ -- die Timeout waiting for encryption threads
+}
+--echo # Success!
+
+--echo # Wait max 10 min for key encryption threads to encrypt all space
+let $cnt=600;
+while ($cnt)
+{
+ let $success=`SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0`;
+ if ($success)
+ {
+ let $cnt=0;
+ }
+ if (!$success)
+ {
+ real_sleep 1;
+ dec $cnt;
+ }
+}
+if (!$success)
+{
+ SELECT * FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION;
+ SHOW STATUS LIKE 'innodb_encryption%';
+ -- die Timeout waiting for encryption threads
+}
+--echo # Success!
+
+--echo # Now turn off encryption and wait for threads to decrypt everything
+SET GLOBAL innodb_encrypt_tables = off;
+
+--echo # Wait max 10 min for key encryption threads to decrypt all space
+let $cnt=600;
+while ($cnt)
+{
+ let $success=`SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0`;
+ if ($success)
+ {
+ let $cnt=0;
+ }
+ if (!$success)
+ {
+ real_sleep 1;
+ dec $cnt;
+ }
+}
+if (!$success)
+{
+ SELECT * FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION;
+ SHOW STATUS LIKE 'innodb_encryption%';
+ -- die Timeout waiting for encryption threads
+}
+--echo # Success!
+
+--echo # Shutdown innodb_encryption_threads
+SET GLOBAL innodb_encryption_threads=0;
+
+--echo # Turn on encryption
+--echo # since threads are off tables should remain unencrypted
+SET GLOBAL innodb_encrypt_tables = on;
+
+--echo # Wait 15s to check that nothing gets encrypted
+let $cnt=15;
+while ($cnt)
+{
+ let $success=`SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0`;
+ if ($success)
+ {
+ real_sleep 1;
+ dec $cnt;
+ }
+ if (!$success)
+ {
+ SELECT * FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
+ -- die Failure, tablespace getting encrypted even if innodb_encryption_threads=0
+ }
+}
+--echo # Success!
+
+--echo # Startup innodb_encryption_threads
+SET GLOBAL innodb_encryption_threads=@start_global_value;
+
+--echo # Wait 1 min to check that it start encrypting again
+let $cnt=60;
+while ($cnt)
+{
+ let $success=`SELECT COUNT(*) > 0 FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0 OR KEY_ROTATION_PAGE_NUMBER IS NOT NULL`;
+ if ($success)
+ {
+ let $cnt=0;
+ }
+ if (!$success)
+ {
+ real_sleep 1;
+ dec $cnt;
+ }
+}
+if (!$success)
+{
+ SELECT * FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION;
+ SHOW STATUS LIKE 'innodb_encryption%';
+ -- die Timeout waiting for encryption threads
+}
+--echo # Success!
+
+--echo #
+--echo # Check that restart with encryption turned off works
+--echo # even if spaces are encrypted
+--echo #
+--echo # First wait max 10 min for key encryption threads to encrypt all spaces
+let $cnt=600;
+while ($cnt)
+{
+ let $success=`SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0`;
+ if ($success)
+ {
+ let $cnt=0;
+ }
+ if (!$success)
+ {
+ real_sleep 1;
+ dec $cnt;
+ }
+}
+if (!$success)
+{
+ SELECT * FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION;
+ SHOW STATUS LIKE 'innodb_encryption%';
+ -- die Timeout waiting for encryption threads
+}
+--echo # Success!
+--echo # Restart mysqld --innodb_encrypt_tables=0 --innodb_encryption_threads=0
+-- let $restart_parameters=--innodb_encrypt_tables=0 --innodb_encryption_threads=0
+-- source include/restart_mysqld.inc
+
+SHOW VARIABLES LIKE 'innodb_encrypt%';
+SELECT COUNT(*) > 0 as should_be_1
+FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION
+WHERE MIN_KEY_VERSION <> 0;
+
+--echo # Restart mysqld again...with default options
+-- let $restart_parameters=
+-- source include/restart_mysqld.inc
diff --git a/mysql-test/suite/innodb/t/innodb_information_schema.test b/mysql-test/suite/innodb/t/innodb_information_schema.test
index 95b436d676c..da7ee016f29 100644
--- a/mysql-test/suite/innodb/t/innodb_information_schema.test
+++ b/mysql-test/suite/innodb/t/innodb_information_schema.test
@@ -5,6 +5,13 @@
-- source include/have_innodb.inc
+# lock data that is part of result set for this testcase
+# is retreived using buf_page_try_get. i.e only show if page
+# happen to be in buffer pool, with key rotation threads
+# chances are substantial that pages have been evicted and lock_data
+# get NULL
+-- source include/not_encrypted.inc
+
-- disable_query_log
-- disable_result_log
diff --git a/mysql-test/suite/innodb/t/innodb_information_schema_buffer.test b/mysql-test/suite/innodb/t/innodb_information_schema_buffer.test
index 6858b898649..5bfac22ec39 100644
--- a/mysql-test/suite/innodb/t/innodb_information_schema_buffer.test
+++ b/mysql-test/suite/innodb/t/innodb_information_schema_buffer.test
@@ -1,6 +1,11 @@
# Exercise the code path for INFORMATION_SCHEMA.INNODB_BUFFER_POOL_STATS
# and INFORMATION_SCHEMA.INNODB_BUFFER_PAGE
+# This test assumes that buffer pool is idle
+# with key rotation threads buffer pages gets evicted this
+# testcase gets flaky
+-- source include/not_encrypted.inc
+
-- source include/have_innodb.inc
-- disable_result_log
diff --git a/mysql-test/suite/innodb/t/innodb_scrub.opt b/mysql-test/suite/innodb/t/innodb_scrub.opt
new file mode 100644
index 00000000000..fd165b269b5
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_scrub.opt
@@ -0,0 +1,14 @@
+--enable-example-key-management-plugin
+--innodb-background-scrub-data-compressed=OFF
+--innodb-background-scrub-data-uncompressed=OFF
+--innodb-encrypt-tables=0
+--innodb-encryption-threads=0
+--innodb-file-format=Barracuda
+--innodb-file-per-table=1
+--innodb-immediate-scrub-data-uncompressed=ON
+--loose-aria-encrypt-tables=ON
+--loose-encrypt-tmp-disk-tables=ON
+--loose-innodb-encrypt-tables=ON
+--loose-innodb-encryption-rotate-key-age=15
+--loose-innodb-encryption-threads=4
+--loose-innodb-scrub-force-testing=ON
diff --git a/mysql-test/suite/innodb/t/innodb_scrub.test b/mysql-test/suite/innodb/t/innodb_scrub.test
new file mode 100644
index 00000000000..9bb7a359e68
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_scrub.test
@@ -0,0 +1,154 @@
+-- source include/have_innodb.inc
+-- source include/not_embedded.inc
+
+let $MYSQLD_DATADIR=`select @@datadir`;
+let ib1_IBD = $MYSQLD_DATADIR/ibdata1;
+let t1_IBD = $MYSQLD_DATADIR/test/t1.ibd;
+
+create table snapshot_status engine = myisam
+select * from information_schema.global_status
+where variable_name like 'innodb_scrub%';
+
+let $rowcount=500;
+let $formatno = 3;
+while ($formatno)
+{
+let $format = `select case $formatno
+ when 1 then 'dynamic'
+ when 2 then 'redundant'
+ when 3 then 'compact'
+ end`;
+dec $formatno;
+
+-- echo #
+-- echo # Test delete of records
+-- echo #
+
+eval create table t1 (
+ a int auto_increment primary key,
+ b varchar(256),
+ c text) engine = innodb row_format=$format;
+
+let $numinserts = $rowcount;
+-- echo # Populate table with rows
+--disable_query_log
+while ($numinserts)
+{
+ dec $numinserts;
+ insert into t1(b,c) values ('bicycle', repeat('repairman', 1000));
+}
+--enable_query_log
+
+delete from t1;
+
+-- echo # restart mysqld so that all pages are flushed
+-- source include/restart_mysqld.inc
+-- echo # read all rows from table
+-- disable_result_log
+select * from t1;
+-- enable_result_log
+
+-- echo # $format: delete from: grep -c bicycle t1.ibd
+-- exec grep -c bicycle $t1_IBD || true
+-- echo # $format: delete from: grep -c bicycle ibdata1
+-- exec grep -c bicycle $ib1_IBD || true
+-- echo # $format: delete from: grep -c repairman t1.ibd
+-- exec grep -c repairman $t1_IBD || true
+-- echo # $format: delete from: grep -c repairman ibdata1
+-- exec grep -c repairman $ib1_IBD || true
+
+drop table t1;
+
+-- echo #
+-- echo # Test delete+rollback+delete
+-- echo #
+
+eval create table t1 (
+ a int auto_increment primary key,
+ b varchar(256),
+ c text) engine = innodb row_format=$format;
+
+let $numinserts = $rowcount;
+-- echo # Populate table with rows
+--disable_query_log
+while ($numinserts)
+{
+ dec $numinserts;
+ insert into t1(b,c) values ('bicycle', repeat('repairman', 1000));
+}
+--enable_query_log
+
+begin;
+delete from t1;
+rollback;
+delete from t1;
+
+-- echo # restart mysqld so that all pages are flushed
+-- source include/restart_mysqld.inc
+-- echo # read all rows from table
+-- disable_result_log
+select * from t1;
+-- enable_result_log
+
+-- echo # $format: delete rollback: grep -c bicycle t1.ibd
+-- exec grep -c bicycle $t1_IBD || true
+-- echo # $format: delete rollback: grep -c bicycle ibdata1
+-- exec grep -c bicycle $ib1_IBD || true
+-- echo # $format: delete rollback: grep -c repairman t1.ibd
+-- exec grep -c repairman $t1_IBD || true
+-- echo # $format: delete rollback: grep -c repairman ibdata1
+-- exec grep -c repairman $ib1_IBD || true
+
+drop table t1;
+
+-- echo #
+-- echo # Test insert+rollback
+-- echo #
+
+eval create table t1 (
+ a int auto_increment primary key,
+ b varchar(256),
+ c text) engine = innodb row_format=$format;
+
+let $numinserts = $rowcount;
+-- echo # Populate table with rows
+begin;
+--disable_query_log
+while ($numinserts)
+{
+ dec $numinserts;
+ insert into t1(b,c) values ('bicycle', repeat('repairman', 1000));
+}
+--enable_query_log
+
+rollback;
+
+-- echo # restart mysqld so that all pages are flushed
+-- source include/restart_mysqld.inc
+-- echo # read all rows from table
+-- disable_result_log
+select * from t1;
+-- enable_result_log
+
+-- echo # $format: insert rollback: grep -c bicycle t1.ibd
+-- exec grep -c bicycle $t1_IBD || true
+-- echo # $format: insert rollback: grep -c bicycle ibdata1
+-- exec grep -c bicycle $ib1_IBD || true
+-- echo # $format: insert rollback: grep -c repairman t1.ibd
+-- exec grep -c repairman $t1_IBD || true
+-- echo # $format: insert rollback: grep -c repairman ibdata1
+-- exec grep -c repairman $ib1_IBD || true
+
+drop table t1;
+}
+
+show variables like 'innodb_%scrub_data%';
+
+--echo # verify that this test have not caused any background scrubbing
+--sorted_result
+select ss.variable_name, gs.variable_value - ss.variable_value as variable_value
+from snapshot_status ss,
+ information_schema.global_status gs
+where ss.variable_name = gs.variable_name;
+
+drop table snapshot_status;
diff --git a/mysql-test/suite/innodb/t/innodb_scrub_background.opt b/mysql-test/suite/innodb/t/innodb_scrub_background.opt
new file mode 100644
index 00000000000..e1fc6d82626
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_scrub_background.opt
@@ -0,0 +1,15 @@
+--enable-example-key-management-plugin
+--innodb-background-scrub-data-compressed=ON
+--innodb-background-scrub-data-uncompressed=ON
+--innodb-encrypt-tables=0
+--innodb-encryption-threads=0
+--innodb-file-format=Barracuda
+--innodb-file-per-table=1
+--innodb-immediate-scrub-data-uncompressed=OFF
+--innodb-tablespaces-scrubbing
+--loose-aria-encrypt-tables=ON
+--loose-encrypt-tmp-disk-tables=ON
+--loose-innodb-encrypt-tables=ON
+--loose-innodb-encryption-rotate-key-age=15
+--loose-innodb-encryption-threads=4
+--loose-innodb-scrub-force-testing=ON
diff --git a/mysql-test/suite/innodb/t/innodb_scrub_background.test b/mysql-test/suite/innodb/t/innodb_scrub_background.test
new file mode 100644
index 00000000000..931177f6fd4
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_scrub_background.test
@@ -0,0 +1,168 @@
+-- source include/have_innodb.inc
+-- source include/not_embedded.inc
+
+let $MYSQLD_DATADIR=`select @@datadir`;
+let ib1_IBD = $MYSQLD_DATADIR/ibdata1;
+let t1_IBD = $MYSQLD_DATADIR/test/t1.ibd;
+let t2_IBD = $MYSQLD_DATADIR/test/t2.ibd;
+let t3_IBD = $MYSQLD_DATADIR/test/t3.ibd;
+
+--echo #
+--echo # immediate scrubbing is off
+--echo # background scrubbing is on
+--echo #
+show variables like 'innodb_%scrub_data%';
+
+-- echo # make sure spaces are checked quickly
+SET GLOBAL innodb_background_scrub_data_check_interval=1;
+
+create table snapshot_status engine = myisam
+select * from information_schema.global_status
+where variable_name like 'innodb_scrub%';
+
+let $rowcount=500;
+let $formatno = 1;
+while ($formatno)
+{
+let $format = `select case $formatno
+ when 1 then 'dynamic'
+ when 2 then 'redundant'
+ when 3 then 'compact'
+ when 4 then 'compressed'
+ end`;
+dec $formatno;
+
+truncate table snapshot_status;
+insert into snapshot_status
+select * from information_schema.global_status
+where variable_name like 'innodb_scrub%';
+
+-- echo #
+-- echo # Test delete of records
+-- echo #
+
+eval create table t1 (
+ a int auto_increment primary key,
+ b varchar(256),
+ c text, index(b)) engine = innodb row_format=$format;
+
+let $numinserts = $rowcount;
+-- echo # Populate table with rows
+--disable_query_log
+while ($numinserts)
+{
+ dec $numinserts;
+ insert into t1(b,c) values ('bicycle', repeat('repairman', 1000));
+}
+--enable_query_log
+
+delete from t1;
+
+-- echo #
+-- echo # Test delete+rollback+delete
+-- echo #
+
+eval create table t2 (
+ a int auto_increment primary key,
+ b varchar(256),
+ c text, index(b)) engine = innodb row_format=$format;
+
+let $numinserts = $rowcount;
+-- echo # Populate table with rows
+--disable_query_log
+while ($numinserts)
+{
+ dec $numinserts;
+ insert into t2(b,c) values ('bicycle', repeat('repairman', 1000));
+}
+--enable_query_log
+
+begin;
+delete from t2;
+rollback;
+delete from t2;
+
+-- echo #
+-- echo # Test insert+rollback
+-- echo #
+
+eval create table t3 (
+ a int auto_increment primary key,
+ b varchar(256),
+ c text, index(b)) engine = innodb row_format=$format;
+
+let $numinserts = $rowcount;
+-- echo # Populate table with rows
+begin;
+--disable_query_log
+while ($numinserts)
+{
+ dec $numinserts;
+ insert into t3(b,c) values ('bicycle', repeat('repairman', 1000));
+}
+--enable_query_log
+
+rollback;
+
+-- echo # start scrubbing threads
+SET GLOBAL innodb_encryption_threads=5;
+-- echo # Wait max 10 min for scrubbing
+let $cnt=600;
+while ($cnt)
+{
+ let $success=`SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_SCRUBBING WHERE LAST_SCRUB_COMPLETED IS NULL AND ( NAME in ('test/t1', 'test/t2', 'test/t3') OR SPACE = 0 )`;
+ if ($success)
+ {
+ let $cnt=0;
+ }
+ if (!$success)
+ {
+ real_sleep 1;
+ dec $cnt;
+ }
+}
+if (!$success)
+{
+ SELECT * FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_SCRUBBING;
+ SHOW STATUS LIKE 'innodb_%scrub%';
+ -- die Timeout waiting for background threads
+}
+-- echo # Success!
+-- echo # stop scrubbing threads
+SET GLOBAL innodb_encryption_threads=0;
+
+-- echo # verify that this test have caused background scrubbing
+--sorted_result
+select sum(gs.variable_value - ss.variable_value) > 0 as should_be_1
+from snapshot_status ss,
+ information_schema.global_status gs
+where ss.variable_name = gs.variable_name;
+
+-- echo # restart mysqld so that all pages are flushed
+-- source include/restart_mysqld.inc
+-- echo # read all rows from table
+-- disable_result_log
+select * from t1;
+-- enable_result_log
+
+-- echo # $format: delete: grep -c bicycle t1.ibd
+-- exec grep -c bicycle $t1_IBD || true
+-- echo # $format: delete: grep -c repairman t1.ibd
+-- exec grep -c repairman $t1_IBD || true
+
+-- echo # $format: delete rollback: grep -c bicycle t2.ibd
+-- exec grep -c bicycle $t2_IBD || true
+-- echo # $format: delete rollback: grep -c repairman t2.ibd
+-- exec grep -c repairman $t2_IBD || true
+
+-- echo # $format: insert rollback: grep -c bicycle t3.ibd
+-- exec grep -c bicycle $t3_IBD || true
+-- echo # $format: insert rollback: grep -c repairman t3.ibd
+-- exec grep -c repairman $t3_IBD || true
+
+drop table t1, t2, t3;
+}
+
+show variables like 'innodb_%scrub_data%';
+
+drop table snapshot_status;
diff --git a/mysql-test/suite/innodb/t/innodb_scrub_compressed.opt b/mysql-test/suite/innodb/t/innodb_scrub_compressed.opt
new file mode 100644
index 00000000000..b956866e648
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_scrub_compressed.opt
@@ -0,0 +1,15 @@
+--enable-example-key-management-plugin
+--innodb-background-scrub-data-compressed=ON
+--innodb-background-scrub-data-uncompressed=ON
+--innodb-encrypt-tables=off
+--innodb-encryption-threads=0
+--innodb-file-format=Barracuda
+--innodb-file-per-table=1
+--innodb-immediate-scrub-data-uncompressed=ON
+--innodb-tablespaces-scrubbing
+--loose-aria-encrypt-tables=ON
+--loose-encrypt-tmp-disk-tables=ON
+--loose-innodb-encrypt-tables=ON
+--loose-innodb-encryption-rotate-key-age=15
+--loose-innodb-encryption-threads=4
+--loose-innodb-scrub-force-testing=ON
diff --git a/mysql-test/suite/innodb/t/innodb_scrub_compressed.test b/mysql-test/suite/innodb/t/innodb_scrub_compressed.test
new file mode 100644
index 00000000000..4e9cf6d9ec9
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_scrub_compressed.test
@@ -0,0 +1,159 @@
+-- source include/have_innodb.inc
+-- source include/not_embedded.inc
+
+let $MYSQLD_DATADIR=`select @@datadir`;
+let ib1_IBD = $MYSQLD_DATADIR/ibdata1;
+let t1_IBD = $MYSQLD_DATADIR/test/t1.ibd;
+let t2_IBD = $MYSQLD_DATADIR/test/t2.ibd;
+let t3_IBD = $MYSQLD_DATADIR/test/t3.ibd;
+
+let $rowcount=500;
+
+-- echo # make sure spaces are checked quickly
+SET GLOBAL innodb_background_scrub_data_check_interval=1;
+
+-- echo #
+-- echo # Test delete of records
+-- echo #
+
+eval create table t1 (
+ a int auto_increment primary key,
+ b varchar(256),
+ c text) engine = innodb row_format=compressed;
+
+let $numinserts = $rowcount;
+-- echo # Populate table with rows
+--disable_query_log
+while ($numinserts)
+{
+ dec $numinserts;
+ insert into t1(b,c) values ('bicycle', repeat('repairman', 1000));
+}
+--enable_query_log
+
+delete from t1;
+
+-- echo #
+-- echo # Test delete+rollback+delete
+-- echo #
+
+eval create table t2 (
+ a int auto_increment primary key,
+ b varchar(256),
+ c text) engine = innodb row_format=compressed;
+
+let $numinserts = $rowcount;
+-- echo # Populate table with rows
+--disable_query_log
+while ($numinserts)
+{
+ dec $numinserts;
+ insert into t2(b,c) values ('boondoggle', repeat('waste of time', 1000));
+}
+--enable_query_log
+
+begin;
+delete from t2;
+rollback;
+delete from t2;
+
+-- echo #
+-- echo # Test insert+rollback
+-- echo #
+
+eval create table t3 (
+ a int auto_increment primary key,
+ b varchar(256),
+ c text) engine = innodb row_format=compressed;
+
+let $numinserts = $rowcount;
+-- echo # Populate table with rows
+begin;
+--disable_query_log
+while ($numinserts)
+{
+ dec $numinserts;
+ insert into t3(b,c) values ('keso', repeat('kent', 1000));
+}
+--enable_query_log
+
+rollback;
+
+-- echo # start scrubbing threads
+SET GLOBAL innodb_encryption_threads=5;
+-- echo # Wait max 10 min for scrubbing of this table
+let $cnt=600;
+while ($cnt)
+{
+ let $success=`SELECT COUNT(*) = 0
+FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_SCRUBBING
+WHERE LAST_SCRUB_COMPLETED IS NULL AND ( NAME like 'test/%' OR SPACE = 0 )`;
+
+ if ($success)
+ {
+ let $cnt=0;
+ }
+ if (!$success)
+ {
+ real_sleep 1;
+ dec $cnt;
+ }
+}
+if (!$success)
+{
+ SELECT * FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_SCRUBBING;
+ SHOW STATUS LIKE 'innodb_%scrub%';
+ -- die Timeout waiting for background threads
+}
+-- echo # Success!
+-- echo # stop scrubbing threads
+SET GLOBAL innodb_encryption_threads=0;
+
+--echo # Now there should be background scrubs
+let $success=`select sum(variable_value) > 0
+from information_schema.global_status
+where variable_name in ('innodb_scrub_background_page_reorganizations',
+'innodb_scrub_background_page_splits')`;
+
+if (!$success) {
+ show status like 'innodb_scrub%';
+}
+
+-- echo # restart mysqld so that all pages are flushed (encryption off)
+-- echo # so that grep will find stuff
+-- source include/restart_mysqld.inc
+-- echo # read all rows from table
+-- disable_result_log
+select * from t1;
+select * from t2;
+select * from t3;
+-- enable_result_log
+
+-- echo # grep -c bicycle t1.ibd
+-- exec grep -c bicycle $t1_IBD || true
+-- echo # grep -c bicycle ibdata1
+-- exec grep -c bicycle $ib1_IBD || true
+-- echo # grep -c repairman t1.ibd
+-- exec grep -c repairman $t1_IBD || true
+-- echo # grep -c repairman ibdata1
+-- exec grep -c repairman $ib1_IBD || true
+
+-- echo # grep -c boondoggle t2.ibd
+-- exec grep -c boondoggle $t2_IBD || true
+-- echo # grep -c boondoggle ibdata1
+-- exec grep -c boondoggle $ib1_IBD || true
+-- echo # grep -c waste t2.ibd
+-- exec grep -c waste $t2_IBD || true
+-- echo # grep -c waste ibdata1
+-- exec grep -c waste $ib1_IBD || true
+
+-- echo # grep -c keso t3.ibd
+-- exec grep -c keso $t3_IBD || true
+-- echo # grep -c keso ibdata1
+-- exec grep -c keso $ib1_IBD || true
+-- echo # grep -c kent t3.ibd
+-- exec grep -c kent $t3_IBD || true
+-- echo # grep -c kent ibdata1
+-- exec grep -c kent $ib1_IBD || true
+
+drop table t1, t2, t3;
diff --git a/mysql-test/suite/innodb_zip/t/innodb_cmp_drop_table.test b/mysql-test/suite/innodb_zip/t/innodb_cmp_drop_table.test
index 4263e839c85..35e4b2c6bf3 100644
--- a/mysql-test/suite/innodb_zip/t/innodb_cmp_drop_table.test
+++ b/mysql-test/suite/innodb_zip/t/innodb_cmp_drop_table.test
@@ -1,5 +1,9 @@
--source include/have_innodb.inc
+# lazy evition might not be lazy enough when key rotation
+# scans through pages
+-- source include/not_encrypted.inc
+
let $per_table=`select @@innodb_file_per_table`;
let $format=`select @@innodb_file_format`;
diff --git a/mysql-test/suite/maria/maria-recovery3.result b/mysql-test/suite/maria/maria-recovery3.result
index d71a3f6c00a..84fd6fbb91e 100644
--- a/mysql-test/suite/maria/maria-recovery3.result
+++ b/mysql-test/suite/maria/maria-recovery3.result
@@ -78,7 +78,7 @@ ERROR HY000: Lost connection to MySQL server during query
* recovery happens
check table t1 extended;
Table Op Msg_type Msg_text
-mysqltest.t1 check warning Size of indexfile is: 372 Expected: 8192
+mysqltest.t1 check warning Size of indexfile is: <SIZE> Expected: 8192
mysqltest.t1 check status OK
* testing that checksum after recovery is as expected
Checksum-check
diff --git a/mysql-test/suite/maria/maria3.result b/mysql-test/suite/maria/maria3.result
index 74eed530bd9..feb5fa82cd4 100644
--- a/mysql-test/suite/maria/maria3.result
+++ b/mysql-test/suite/maria/maria3.result
@@ -305,6 +305,7 @@ Variable_name Value
aria_block_size 8192
aria_checkpoint_interval 30
aria_checkpoint_log_activity 1048576
+aria_encrypt_tables OFF
aria_force_start_after_recovery_failures 0
aria_group_commit none
aria_group_commit_interval 0
diff --git a/mysql-test/suite/sys_vars/r/aria_encrypt_tables_basic.result b/mysql-test/suite/sys_vars/r/aria_encrypt_tables_basic.result
new file mode 100644
index 00000000000..bf40f534bd6
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/aria_encrypt_tables_basic.result
@@ -0,0 +1,41 @@
+SET @start_global_value = @@global.aria_encrypt_tables;
+select @@global.aria_encrypt_tables;
+@@global.aria_encrypt_tables
+0
+select @@session.aria_encrypt_tables;
+ERROR HY000: Variable 'aria_encrypt_tables' is a GLOBAL variable
+show global variables like 'aria_encrypt_tables';
+Variable_name Value
+aria_encrypt_tables OFF
+show session variables like 'aria_encrypt_tables';
+Variable_name Value
+aria_encrypt_tables OFF
+select * from information_schema.global_variables
+where variable_name='aria_encrypt_tables';
+VARIABLE_NAME VARIABLE_VALUE
+ARIA_ENCRYPT_TABLES OFF
+select * from information_schema.session_variables
+where variable_name='aria_encrypt_tables';
+VARIABLE_NAME VARIABLE_VALUE
+ARIA_ENCRYPT_TABLES OFF
+set global aria_encrypt_tables=ON;
+select @@global.aria_encrypt_tables;
+@@global.aria_encrypt_tables
+1
+set global aria_encrypt_tables=OFF;
+select @@global.aria_encrypt_tables;
+@@global.aria_encrypt_tables
+0
+set global aria_encrypt_tables=1;
+select @@global.aria_encrypt_tables;
+@@global.aria_encrypt_tables
+1
+set session aria_encrypt_tables=1;
+ERROR HY000: Variable 'aria_encrypt_tables' is a GLOBAL variable and should be set with SET GLOBAL
+set global aria_encrypt_tables=1.1;
+ERROR 42000: Incorrect argument type to variable 'aria_encrypt_tables'
+set global aria_encrypt_tables=1e1;
+ERROR 42000: Incorrect argument type to variable 'aria_encrypt_tables'
+set global aria_encrypt_tables="foo";
+ERROR 42000: Variable 'aria_encrypt_tables' can't be set to the value of 'foo'
+SET @@global.aria_encrypt_tables = @start_global_value;
diff --git a/mysql-test/suite/sys_vars/r/debug_use_static_encryption_keys_basic.result b/mysql-test/suite/sys_vars/r/debug_use_static_encryption_keys_basic.result
new file mode 100644
index 00000000000..a0d4f45cdbf
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/debug_use_static_encryption_keys_basic.result
@@ -0,0 +1,3 @@
+show global variables like "debug_use_static_encryption_keys";
+Variable_name Value
+debug_use_static_encryption_keys OFF
diff --git a/mysql-test/suite/sys_vars/r/encrypt_tmp_disk_tables_basic.result b/mysql-test/suite/sys_vars/r/encrypt_tmp_disk_tables_basic.result
new file mode 100644
index 00000000000..833ad5287ba
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/encrypt_tmp_disk_tables_basic.result
@@ -0,0 +1,41 @@
+SET @start_global_value = @@global.encrypt_tmp_disk_tables;
+select @@global.encrypt_tmp_disk_tables;
+@@global.encrypt_tmp_disk_tables
+0
+select @@session.encrypt_tmp_disk_tables;
+ERROR HY000: Variable 'encrypt_tmp_disk_tables' is a GLOBAL variable
+show global variables like 'encrypt_tmp_disk_tables';
+Variable_name Value
+encrypt_tmp_disk_tables OFF
+show session variables like 'encrypt_tmp_disk_tables';
+Variable_name Value
+encrypt_tmp_disk_tables OFF
+select * from information_schema.global_variables
+where variable_name='encrypt_tmp_disk_tables';
+VARIABLE_NAME VARIABLE_VALUE
+ENCRYPT_TMP_DISK_TABLES OFF
+select * from information_schema.session_variables
+where variable_name='encrypt_tmp_disk_tables';
+VARIABLE_NAME VARIABLE_VALUE
+ENCRYPT_TMP_DISK_TABLES OFF
+set global encrypt_tmp_disk_tables=ON;
+select @@global.encrypt_tmp_disk_tables;
+@@global.encrypt_tmp_disk_tables
+1
+set global encrypt_tmp_disk_tables=OFF;
+select @@global.encrypt_tmp_disk_tables;
+@@global.encrypt_tmp_disk_tables
+0
+set global encrypt_tmp_disk_tables=1;
+select @@global.encrypt_tmp_disk_tables;
+@@global.encrypt_tmp_disk_tables
+1
+set session encrypt_tmp_disk_tables=1;
+ERROR HY000: Variable 'encrypt_tmp_disk_tables' is a GLOBAL variable and should be set with SET GLOBAL
+set global encrypt_tmp_disk_tables=1.1;
+ERROR 42000: Incorrect argument type to variable 'encrypt_tmp_disk_tables'
+set global encrypt_tmp_disk_tables=1e1;
+ERROR 42000: Incorrect argument type to variable 'encrypt_tmp_disk_tables'
+set global encrypt_tmp_disk_tables="foo";
+ERROR 42000: Variable 'encrypt_tmp_disk_tables' can't be set to the value of 'foo'
+SET @@global.encrypt_tmp_disk_tables = @start_global_value;
diff --git a/mysql-test/suite/sys_vars/r/encryption_algorithm_basic.result b/mysql-test/suite/sys_vars/r/encryption_algorithm_basic.result
new file mode 100644
index 00000000000..a9101b0f950
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/encryption_algorithm_basic.result
@@ -0,0 +1,7 @@
+select @@global.encryption_algorithm;
+@@global.encryption_algorithm
+none
+select @@session.encryption_algorithm;
+ERROR HY000: Variable 'encryption_algorithm' is a GLOBAL variable
+set global encryption_algorithm="none";
+ERROR HY000: Variable 'encryption_algorithm' is a read only variable
diff --git a/mysql-test/suite/sys_vars/r/innodb_background_scrub_data_check_interval_basic.result b/mysql-test/suite/sys_vars/r/innodb_background_scrub_data_check_interval_basic.result
new file mode 100644
index 00000000000..5a8734a9446
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/innodb_background_scrub_data_check_interval_basic.result
@@ -0,0 +1,72 @@
+SET @start_global_value = @@global.innodb_background_scrub_data_check_interval;
+#
+# default value
+#
+select @@global.innodb_background_scrub_data_check_interval;
+@@global.innodb_background_scrub_data_check_interval
+3600
+set global innodb_background_scrub_data_check_interval=10;
+select @@global.innodb_background_scrub_data_check_interval;
+@@global.innodb_background_scrub_data_check_interval
+10
+set global innodb_background_scrub_data_check_interval=DEFAULT;
+select @@global.innodb_background_scrub_data_check_interval;
+@@global.innodb_background_scrub_data_check_interval
+3600
+set global innodb_background_scrub_data_check_interval=20;
+select @@global.innodb_background_scrub_data_check_interval;
+@@global.innodb_background_scrub_data_check_interval
+20
+set global innodb_background_scrub_data_check_interval=DEFAULT;
+select @@global.innodb_background_scrub_data_check_interval;
+@@global.innodb_background_scrub_data_check_interval
+3600
+#
+# exists as global only
+#
+select @@global.innodb_background_scrub_data_check_interval;
+@@global.innodb_background_scrub_data_check_interval
+3600
+select @@session.innodb_background_scrub_data_check_interval;
+ERROR HY000: Variable 'innodb_background_scrub_data_check_interval' is a GLOBAL variable
+show global variables like 'innodb_background_scrub_data_check_interval';
+Variable_name Value
+innodb_background_scrub_data_check_interval 3600
+show session variables like 'innodb_background_scrub_data_check_interval';
+Variable_name Value
+innodb_background_scrub_data_check_interval 3600
+select * from information_schema.global_variables
+where variable_name='innodb_background_scrub_data_check_interval';
+VARIABLE_NAME VARIABLE_VALUE
+INNODB_BACKGROUND_SCRUB_DATA_CHECK_INTERVAL 3600
+select * from information_schema.session_variables
+where variable_name='innodb_background_scrub_data_check_interval';
+VARIABLE_NAME VARIABLE_VALUE
+INNODB_BACKGROUND_SCRUB_DATA_CHECK_INTERVAL 3600
+#
+# show that it's writable
+#
+set global innodb_background_scrub_data_check_interval=10;
+select @@global.innodb_background_scrub_data_check_interval;
+@@global.innodb_background_scrub_data_check_interval
+10
+set global innodb_background_scrub_data_check_interval=20;
+select @@global.innodb_background_scrub_data_check_interval;
+@@global.innodb_background_scrub_data_check_interval
+20
+set global innodb_background_scrub_data_check_interval=1;
+select @@global.innodb_background_scrub_data_check_interval;
+@@global.innodb_background_scrub_data_check_interval
+1
+set session innodb_background_scrub_data_check_interval=1;
+ERROR HY000: Variable 'innodb_background_scrub_data_check_interval' is a GLOBAL variable and should be set with SET GLOBAL
+#
+# incorrect types
+#
+set global innodb_background_scrub_data_check_interval=1.1;
+ERROR 42000: Incorrect argument type to variable 'innodb_background_scrub_data_check_interval'
+set global innodb_background_scrub_data_check_interval=1e1;
+ERROR 42000: Incorrect argument type to variable 'innodb_background_scrub_data_check_interval'
+set global innodb_background_scrub_data_check_interval="foo";
+ERROR 42000: Incorrect argument type to variable 'innodb_background_scrub_data_check_interval'
+SET @@global.innodb_background_scrub_data_check_interval = @start_global_value;
diff --git a/mysql-test/suite/sys_vars/r/innodb_background_scrub_data_compressed_basic.result b/mysql-test/suite/sys_vars/r/innodb_background_scrub_data_compressed_basic.result
new file mode 100644
index 00000000000..7a1fd978bd2
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/innodb_background_scrub_data_compressed_basic.result
@@ -0,0 +1,50 @@
+SET @start_global_value = @@global.innodb_background_scrub_data_compressed;
+#
+# exists as global only
+#
+select @@global.innodb_background_scrub_data_compressed;
+@@global.innodb_background_scrub_data_compressed
+0
+select @@session.innodb_background_scrub_data_compressed;
+ERROR HY000: Variable 'innodb_background_scrub_data_compressed' is a GLOBAL variable
+show global variables like 'innodb_background_scrub_data_compressed';
+Variable_name Value
+innodb_background_scrub_data_compressed OFF
+show session variables like 'innodb_background_scrub_data_compressed';
+Variable_name Value
+innodb_background_scrub_data_compressed OFF
+select * from information_schema.global_variables
+where variable_name='innodb_background_scrub_data_compressed';
+VARIABLE_NAME VARIABLE_VALUE
+INNODB_BACKGROUND_SCRUB_DATA_COMPRESSED OFF
+select * from information_schema.session_variables
+where variable_name='innodb_background_scrub_data_compressed';
+VARIABLE_NAME VARIABLE_VALUE
+INNODB_BACKGROUND_SCRUB_DATA_COMPRESSED OFF
+#
+# show that it's writable
+#
+set global innodb_background_scrub_data_compressed=ON;
+select @@global.innodb_background_scrub_data_compressed;
+@@global.innodb_background_scrub_data_compressed
+1
+set global innodb_background_scrub_data_compressed=OFF;
+select @@global.innodb_background_scrub_data_compressed;
+@@global.innodb_background_scrub_data_compressed
+0
+set global innodb_background_scrub_data_compressed=1;
+select @@global.innodb_background_scrub_data_compressed;
+@@global.innodb_background_scrub_data_compressed
+1
+set session innodb_background_scrub_data_compressed=1;
+ERROR HY000: Variable 'innodb_background_scrub_data_compressed' is a GLOBAL variable and should be set with SET GLOBAL
+#
+# incorrect types
+#
+set global innodb_background_scrub_data_compressed=1.1;
+ERROR 42000: Incorrect argument type to variable 'innodb_background_scrub_data_compressed'
+set global innodb_background_scrub_data_compressed=1e1;
+ERROR 42000: Incorrect argument type to variable 'innodb_background_scrub_data_compressed'
+set global innodb_background_scrub_data_compressed="foo";
+ERROR 42000: Variable 'innodb_background_scrub_data_compressed' can't be set to the value of 'foo'
+SET @@global.innodb_background_scrub_data_compressed = @start_global_value;
diff --git a/mysql-test/suite/sys_vars/r/innodb_background_scrub_data_interval_basic.result b/mysql-test/suite/sys_vars/r/innodb_background_scrub_data_interval_basic.result
new file mode 100644
index 00000000000..49bbc8cd34a
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/innodb_background_scrub_data_interval_basic.result
@@ -0,0 +1,50 @@
+SET @start_global_value = @@global.innodb_background_scrub_data_interval;
+#
+# exists as global only
+#
+select @@global.innodb_background_scrub_data_interval;
+@@global.innodb_background_scrub_data_interval
+604800
+select @@session.innodb_background_scrub_data_interval;
+ERROR HY000: Variable 'innodb_background_scrub_data_interval' is a GLOBAL variable
+show global variables like 'innodb_background_scrub_data_interval';
+Variable_name Value
+innodb_background_scrub_data_interval 604800
+show session variables like 'innodb_background_scrub_data_interval';
+Variable_name Value
+innodb_background_scrub_data_interval 604800
+select * from information_schema.global_variables
+where variable_name='innodb_background_scrub_data_interval';
+VARIABLE_NAME VARIABLE_VALUE
+INNODB_BACKGROUND_SCRUB_DATA_INTERVAL 604800
+select * from information_schema.session_variables
+where variable_name='innodb_background_scrub_data_interval';
+VARIABLE_NAME VARIABLE_VALUE
+INNODB_BACKGROUND_SCRUB_DATA_INTERVAL 604800
+#
+# show that it's writable
+#
+set global innodb_background_scrub_data_interval=100;
+select @@global.innodb_background_scrub_data_interval;
+@@global.innodb_background_scrub_data_interval
+100
+set global innodb_background_scrub_data_interval=200;
+select @@global.innodb_background_scrub_data_interval;
+@@global.innodb_background_scrub_data_interval
+200
+set global innodb_background_scrub_data_interval=300;
+select @@global.innodb_background_scrub_data_interval;
+@@global.innodb_background_scrub_data_interval
+300
+set session innodb_background_scrub_data_interval=400;
+ERROR HY000: Variable 'innodb_background_scrub_data_interval' is a GLOBAL variable and should be set with SET GLOBAL
+#
+# incorrect types
+#
+set global innodb_background_scrub_data_interval=1.1;
+ERROR 42000: Incorrect argument type to variable 'innodb_background_scrub_data_interval'
+set global innodb_background_scrub_data_interval=1e1;
+ERROR 42000: Incorrect argument type to variable 'innodb_background_scrub_data_interval'
+set global innodb_background_scrub_data_interval="foo";
+ERROR 42000: Incorrect argument type to variable 'innodb_background_scrub_data_interval'
+SET @@global.innodb_background_scrub_data_interval = @start_global_value;
diff --git a/mysql-test/suite/sys_vars/r/innodb_background_scrub_data_uncompressed_basic.result b/mysql-test/suite/sys_vars/r/innodb_background_scrub_data_uncompressed_basic.result
new file mode 100644
index 00000000000..c85bde6493f
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/innodb_background_scrub_data_uncompressed_basic.result
@@ -0,0 +1,50 @@
+SET @start_global_value = @@global.innodb_background_scrub_data_uncompressed;
+#
+# exists as global only
+#
+select @@global.innodb_background_scrub_data_uncompressed;
+@@global.innodb_background_scrub_data_uncompressed
+0
+select @@session.innodb_background_scrub_data_uncompressed;
+ERROR HY000: Variable 'innodb_background_scrub_data_uncompressed' is a GLOBAL variable
+show global variables like 'innodb_background_scrub_data_uncompressed';
+Variable_name Value
+innodb_background_scrub_data_uncompressed OFF
+show session variables like 'innodb_background_scrub_data_uncompressed';
+Variable_name Value
+innodb_background_scrub_data_uncompressed OFF
+select * from information_schema.global_variables
+where variable_name='innodb_background_scrub_data_uncompressed';
+VARIABLE_NAME VARIABLE_VALUE
+INNODB_BACKGROUND_SCRUB_DATA_UNCOMPRESSED OFF
+select * from information_schema.session_variables
+where variable_name='innodb_background_scrub_data_uncompressed';
+VARIABLE_NAME VARIABLE_VALUE
+INNODB_BACKGROUND_SCRUB_DATA_UNCOMPRESSED OFF
+#
+# show that it's writable
+#
+set global innodb_background_scrub_data_uncompressed=ON;
+select @@global.innodb_background_scrub_data_uncompressed;
+@@global.innodb_background_scrub_data_uncompressed
+1
+set global innodb_background_scrub_data_uncompressed=OFF;
+select @@global.innodb_background_scrub_data_uncompressed;
+@@global.innodb_background_scrub_data_uncompressed
+0
+set global innodb_background_scrub_data_uncompressed=1;
+select @@global.innodb_background_scrub_data_uncompressed;
+@@global.innodb_background_scrub_data_uncompressed
+1
+set session innodb_background_scrub_data_uncompressed=1;
+ERROR HY000: Variable 'innodb_background_scrub_data_uncompressed' is a GLOBAL variable and should be set with SET GLOBAL
+#
+# incorrect types
+#
+set global innodb_background_scrub_data_uncompressed=1.1;
+ERROR 42000: Incorrect argument type to variable 'innodb_background_scrub_data_uncompressed'
+set global innodb_background_scrub_data_uncompressed=1e1;
+ERROR 42000: Incorrect argument type to variable 'innodb_background_scrub_data_uncompressed'
+set global innodb_background_scrub_data_uncompressed="foo";
+ERROR 42000: Variable 'innodb_background_scrub_data_uncompressed' can't be set to the value of 'foo'
+SET @@global.innodb_background_scrub_data_uncompressed = @start_global_value;
diff --git a/mysql-test/suite/sys_vars/r/innodb_data_encryption_filekey_basic.result b/mysql-test/suite/sys_vars/r/innodb_data_encryption_filekey_basic.result
new file mode 100644
index 00000000000..f7660620a2f
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/innodb_data_encryption_filekey_basic.result
@@ -0,0 +1,9 @@
+SELECT @start_data_encryption_filekey;
+@start_data_encryption_filekey
+NULL
+SELECT COUNT(@@GLOBAL.innodb_data_encryption_filekey);
+COUNT(@@GLOBAL.innodb_data_encryption_filekey)
+0
+1 Expected
+SET @@GLOBAL.innodb_data_encryption_filekey='secret';
+ERROR HY000: Variable 'innodb_data_encryption_filekey' is a read only variable
diff --git a/mysql-test/suite/sys_vars/r/innodb_data_encryption_providername_basic.result b/mysql-test/suite/sys_vars/r/innodb_data_encryption_providername_basic.result
new file mode 100644
index 00000000000..12b4407290b
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/innodb_data_encryption_providername_basic.result
@@ -0,0 +1,9 @@
+SELECT @start_data_encryption_providername;
+@start_data_encryption_providername
+NULL
+SELECT COUNT(@@GLOBAL.innodb_data_encryption_providername);
+COUNT(@@GLOBAL.innodb_data_encryption_providername)
+0
+1 Expected
+SET @@GLOBAL.innodb_data_encryption_providername='key.txt';
+ERROR HY000: Variable 'innodb_data_encryption_providername' is a read only variable
diff --git a/mysql-test/suite/sys_vars/r/innodb_data_encryption_providertype_basic.result b/mysql-test/suite/sys_vars/r/innodb_data_encryption_providertype_basic.result
new file mode 100644
index 00000000000..8a45857496e
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/innodb_data_encryption_providertype_basic.result
@@ -0,0 +1,11 @@
+SELECT @start_data_encryption_providertype;
+@start_data_encryption_providertype
+NULL
+SELECT COUNT(@@GLOBAL.innodb_data_encryption_providertype);
+COUNT(@@GLOBAL.innodb_data_encryption_providertype)
+1
+1 Expected
+SET @@GLOBAL.innodb_data_encryption_providertype=1;
+ERROR HY000: Variable 'innodb_data_encryption_providertype' is a read only variable
+SET @@GLOBAL.innodb_data_encryption_providertype=k;
+ERROR HY000: Variable 'innodb_data_encryption_providertype' is a read only variable
diff --git a/mysql-test/suite/sys_vars/r/innodb_data_encryption_providerurl_basic.result b/mysql-test/suite/sys_vars/r/innodb_data_encryption_providerurl_basic.result
new file mode 100644
index 00000000000..2a0fa74b347
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/innodb_data_encryption_providerurl_basic.result
@@ -0,0 +1,9 @@
+SELECT @start_data_encryption_providerurl;
+@start_data_encryption_providerurl
+NULL
+SELECT COUNT(@@GLOBAL.innodb_data_encryption_providerurl);
+COUNT(@@GLOBAL.innodb_data_encryption_providerurl)
+0
+1 Expected
+SET @@GLOBAL.innodb_data_encryption_providerurl='http://www.google.com';
+ERROR HY000: Variable 'innodb_data_encryption_providerurl' is a read only variable
diff --git a/mysql-test/suite/sys_vars/r/innodb_encrypt_log_basic.result b/mysql-test/suite/sys_vars/r/innodb_encrypt_log_basic.result
new file mode 100644
index 00000000000..4beb1a01edf
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/innodb_encrypt_log_basic.result
@@ -0,0 +1,48 @@
+SELECT @@GLOBAL.innodb_encrypt_log;
+@@GLOBAL.innodb_encrypt_log
+0
+0 Expected
+SET @@GLOBAL.innodb_encrypt_log=1;
+ERROR HY000: Variable 'innodb_encrypt_log' is a read only variable
+Expected error 'Read only variable'
+SELECT @@GLOBAL.innodb_encrypt_log;
+@@GLOBAL.innodb_encrypt_log
+0
+0 Expected
+SELECT IF(@@GLOBAL.innodb_encrypt_log, 'ON', 'OFF') = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_encrypt_log';
+IF(@@GLOBAL.innodb_encrypt_log, 'ON', 'OFF') = VARIABLE_VALUE
+1
+1 Expected
+SELECT @@GLOBAL.innodb_encrypt_log;
+@@GLOBAL.innodb_encrypt_log
+0
+0 Expected
+SELECT VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_encrypt_log';
+VARIABLE_VALUE
+OFF
+0 Expected
+SELECT @@innodb_encrypt_log = @@GLOBAL.innodb_encrypt_log;
+@@innodb_encrypt_log = @@GLOBAL.innodb_encrypt_log
+1
+1 Expected
+SELECT @@innodb_encrypt_log;
+@@innodb_encrypt_log
+0
+0 Expected
+SELECT COUNT(@@local.innodb_encrypt_log);
+ERROR HY000: Variable 'innodb_encrypt_log' is a GLOBAL variable
+Expected error 'Variable is a GLOBAL variable'
+SELECT COUNT(@@SESSION.innodb_encrypt_log);
+ERROR HY000: Variable 'innodb_encrypt_log' is a GLOBAL variable
+Expected error 'Variable is a GLOBAL variable'
+SELECT @@GLOBAL.innodb_encrypt_log;
+@@GLOBAL.innodb_encrypt_log
+0
+0 Expected
+SELECT innodb_encrypt_log;
+ERROR 42S22: Unknown column 'innodb_encrypt_log' in 'field list'
+Expected error 'Unknown column in field list'
diff --git a/mysql-test/suite/sys_vars/r/innodb_encrypt_tables_basic.result b/mysql-test/suite/sys_vars/r/innodb_encrypt_tables_basic.result
new file mode 100644
index 00000000000..87212399f09
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/innodb_encrypt_tables_basic.result
@@ -0,0 +1,41 @@
+SET @start_global_value = @@global.innodb_encrypt_tables;
+select @@global.innodb_encrypt_tables;
+@@global.innodb_encrypt_tables
+0
+select @@session.innodb_encrypt_tables;
+ERROR HY000: Variable 'innodb_encrypt_tables' is a GLOBAL variable
+show global variables like 'innodb_encrypt_tables';
+Variable_name Value
+innodb_encrypt_tables OFF
+show session variables like 'innodb_encrypt_tables';
+Variable_name Value
+innodb_encrypt_tables OFF
+select * from information_schema.global_variables
+where variable_name='innodb_encrypt_tables';
+VARIABLE_NAME VARIABLE_VALUE
+INNODB_ENCRYPT_TABLES OFF
+select * from information_schema.session_variables
+where variable_name='innodb_encrypt_tables';
+VARIABLE_NAME VARIABLE_VALUE
+INNODB_ENCRYPT_TABLES OFF
+set global innodb_encrypt_tables=ON;
+select @@global.innodb_encrypt_tables;
+@@global.innodb_encrypt_tables
+1
+set global innodb_encrypt_tables=OFF;
+select @@global.innodb_encrypt_tables;
+@@global.innodb_encrypt_tables
+0
+set global innodb_encrypt_tables=1;
+select @@global.innodb_encrypt_tables;
+@@global.innodb_encrypt_tables
+1
+set session innodb_encrypt_tables=1;
+ERROR HY000: Variable 'innodb_encrypt_tables' is a GLOBAL variable and should be set with SET GLOBAL
+set global innodb_encrypt_tables=1.1;
+ERROR 42000: Incorrect argument type to variable 'innodb_encrypt_tables'
+set global innodb_encrypt_tables=1e1;
+ERROR 42000: Incorrect argument type to variable 'innodb_encrypt_tables'
+set global innodb_encrypt_tables="foo";
+ERROR 42000: Variable 'innodb_encrypt_tables' can't be set to the value of 'foo'
+SET @@global.innodb_encrypt_tables = @start_global_value;
diff --git a/mysql-test/suite/sys_vars/r/innodb_encryption_rotate_key_age_basic.result b/mysql-test/suite/sys_vars/r/innodb_encryption_rotate_key_age_basic.result
new file mode 100644
index 00000000000..9f4c672f719
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/innodb_encryption_rotate_key_age_basic.result
@@ -0,0 +1,41 @@
+SET @start_global_value = @@global.innodb_encryption_rotate_key_age;
+select @@global.innodb_encryption_rotate_key_age;
+@@global.innodb_encryption_rotate_key_age
+1
+select @@session.innodb_encryption_rotate_key_age;
+ERROR HY000: Variable 'innodb_encryption_rotate_key_age' is a GLOBAL variable
+show global variables like 'innodb_encryption_rotate_key_age';
+Variable_name Value
+innodb_encryption_rotate_key_age 1
+show session variables like 'innodb_encryption_rotate_key_age';
+Variable_name Value
+innodb_encryption_rotate_key_age 1
+select * from information_schema.global_variables
+where variable_name='innodb_encryption_rotate_key_age';
+VARIABLE_NAME VARIABLE_VALUE
+INNODB_ENCRYPTION_ROTATE_KEY_AGE 1
+select * from information_schema.session_variables
+where variable_name='innodb_encryption_rotate_key_age';
+VARIABLE_NAME VARIABLE_VALUE
+INNODB_ENCRYPTION_ROTATE_KEY_AGE 1
+set global innodb_encryption_rotate_key_age=1;
+select @@global.innodb_encryption_rotate_key_age;
+@@global.innodb_encryption_rotate_key_age
+1
+set global innodb_encryption_rotate_key_age=2;
+select @@global.innodb_encryption_rotate_key_age;
+@@global.innodb_encryption_rotate_key_age
+2
+set global innodb_encryption_rotate_key_age=1;
+select @@global.innodb_encryption_rotate_key_age;
+@@global.innodb_encryption_rotate_key_age
+1
+set session innodb_encryption_rotate_key_age=1;
+ERROR HY000: Variable 'innodb_encryption_rotate_key_age' is a GLOBAL variable and should be set with SET GLOBAL
+set global innodb_encryption_rotate_key_age=1.1;
+ERROR 42000: Incorrect argument type to variable 'innodb_encryption_rotate_key_age'
+set global innodb_encryption_rotate_key_age=1e1;
+ERROR 42000: Incorrect argument type to variable 'innodb_encryption_rotate_key_age'
+set global innodb_encryption_rotate_key_age="foo";
+ERROR 42000: Incorrect argument type to variable 'innodb_encryption_rotate_key_age'
+SET @@global.innodb_encryption_rotate_key_age = @start_global_value;
diff --git a/mysql-test/suite/sys_vars/r/innodb_encryption_rotation_iops_basic.result b/mysql-test/suite/sys_vars/r/innodb_encryption_rotation_iops_basic.result
new file mode 100644
index 00000000000..5a7267d2815
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/innodb_encryption_rotation_iops_basic.result
@@ -0,0 +1,41 @@
+SET @start_global_value = @@global.innodb_encryption_rotation_iops;
+select @@global.innodb_encryption_rotation_iops;
+@@global.innodb_encryption_rotation_iops
+100
+select @@session.innodb_encryption_rotation_iops;
+ERROR HY000: Variable 'innodb_encryption_rotation_iops' is a GLOBAL variable
+show global variables like 'innodb_encryption_rotation_iops';
+Variable_name Value
+innodb_encryption_rotation_iops 100
+show session variables like 'innodb_encryption_rotation_iops';
+Variable_name Value
+innodb_encryption_rotation_iops 100
+select * from information_schema.global_variables
+where variable_name='innodb_encryption_rotation_iops';
+VARIABLE_NAME VARIABLE_VALUE
+INNODB_ENCRYPTION_ROTATION_IOPS 100
+select * from information_schema.session_variables
+where variable_name='innodb_encryption_rotation_iops';
+VARIABLE_NAME VARIABLE_VALUE
+INNODB_ENCRYPTION_ROTATION_IOPS 100
+set global innodb_encryption_rotation_iops=100;
+select @@global.innodb_encryption_rotation_iops;
+@@global.innodb_encryption_rotation_iops
+100
+set global innodb_encryption_rotation_iops=50;
+select @@global.innodb_encryption_rotation_iops;
+@@global.innodb_encryption_rotation_iops
+50
+set global innodb_encryption_rotation_iops=100;
+select @@global.innodb_encryption_rotation_iops;
+@@global.innodb_encryption_rotation_iops
+100
+set session innodb_encryption_rotation_iops=50;
+ERROR HY000: Variable 'innodb_encryption_rotation_iops' is a GLOBAL variable and should be set with SET GLOBAL
+set global innodb_encryption_rotation_iops=1.1;
+ERROR 42000: Incorrect argument type to variable 'innodb_encryption_rotation_iops'
+set global innodb_encryption_rotation_iops=1e1;
+ERROR 42000: Incorrect argument type to variable 'innodb_encryption_rotation_iops'
+set global innodb_encryption_rotation_iops="foo";
+ERROR 42000: Incorrect argument type to variable 'innodb_encryption_rotation_iops'
+SET @@global.innodb_encryption_rotation_iops = @start_global_value;
diff --git a/mysql-test/suite/sys_vars/r/innodb_encryption_threads_basic.result b/mysql-test/suite/sys_vars/r/innodb_encryption_threads_basic.result
new file mode 100644
index 00000000000..727a08c9cc6
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/innodb_encryption_threads_basic.result
@@ -0,0 +1,41 @@
+SET @start_global_value = @@global.innodb_encryption_threads;
+select @@global.innodb_encryption_threads;
+@@global.innodb_encryption_threads
+0
+select @@session.innodb_encryption_threads;
+ERROR HY000: Variable 'innodb_encryption_threads' is a GLOBAL variable
+show global variables like 'innodb_encryption_threads';
+Variable_name Value
+innodb_encryption_threads 0
+show session variables like 'innodb_encryption_threads';
+Variable_name Value
+innodb_encryption_threads 0
+select * from information_schema.global_variables
+where variable_name='innodb_encryption_threads';
+VARIABLE_NAME VARIABLE_VALUE
+INNODB_ENCRYPTION_THREADS 0
+select * from information_schema.session_variables
+where variable_name='innodb_encryption_threads';
+VARIABLE_NAME VARIABLE_VALUE
+INNODB_ENCRYPTION_THREADS 0
+set global innodb_encryption_threads=0;
+select @@global.innodb_encryption_threads;
+@@global.innodb_encryption_threads
+0
+set global innodb_encryption_threads=5;
+select @@global.innodb_encryption_threads;
+@@global.innodb_encryption_threads
+5
+set global innodb_encryption_threads=1;
+select @@global.innodb_encryption_threads;
+@@global.innodb_encryption_threads
+1
+set session innodb_encryption_threads=1;
+ERROR HY000: Variable 'innodb_encryption_threads' is a GLOBAL variable and should be set with SET GLOBAL
+set global innodb_encryption_threads=1.1;
+ERROR 42000: Incorrect argument type to variable 'innodb_encryption_threads'
+set global innodb_encryption_threads=1e1;
+ERROR 42000: Incorrect argument type to variable 'innodb_encryption_threads'
+set global innodb_encryption_threads="foo";
+ERROR 42000: Incorrect argument type to variable 'innodb_encryption_threads'
+SET @@global.innodb_encryption_threads = @start_global_value;
diff --git a/mysql-test/suite/sys_vars/r/innodb_immediate_scrub_data_uncompressed_basic.result b/mysql-test/suite/sys_vars/r/innodb_immediate_scrub_data_uncompressed_basic.result
new file mode 100644
index 00000000000..5b31918c5d2
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/innodb_immediate_scrub_data_uncompressed_basic.result
@@ -0,0 +1,50 @@
+SET @start_global_value = @@global.innodb_immediate_scrub_data_uncompressed;
+#
+# exists as global only
+#
+select @@global.innodb_immediate_scrub_data_uncompressed;
+@@global.innodb_immediate_scrub_data_uncompressed
+0
+select @@session.innodb_immediate_scrub_data_uncompressed;
+ERROR HY000: Variable 'innodb_immediate_scrub_data_uncompressed' is a GLOBAL variable
+show global variables like 'innodb_immediate_scrub_data_uncompressed';
+Variable_name Value
+innodb_immediate_scrub_data_uncompressed OFF
+show session variables like 'innodb_immediate_scrub_data_uncompressed';
+Variable_name Value
+innodb_immediate_scrub_data_uncompressed OFF
+select * from information_schema.global_variables
+where variable_name='innodb_immediate_scrub_data_uncompressed';
+VARIABLE_NAME VARIABLE_VALUE
+INNODB_IMMEDIATE_SCRUB_DATA_UNCOMPRESSED OFF
+select * from information_schema.session_variables
+where variable_name='innodb_immediate_scrub_data_uncompressed';
+VARIABLE_NAME VARIABLE_VALUE
+INNODB_IMMEDIATE_SCRUB_DATA_UNCOMPRESSED OFF
+#
+# show that it's writable
+#
+set global innodb_immediate_scrub_data_uncompressed=ON;
+select @@global.innodb_immediate_scrub_data_uncompressed;
+@@global.innodb_immediate_scrub_data_uncompressed
+1
+set global innodb_immediate_scrub_data_uncompressed=OFF;
+select @@global.innodb_immediate_scrub_data_uncompressed;
+@@global.innodb_immediate_scrub_data_uncompressed
+0
+set global innodb_immediate_scrub_data_uncompressed=1;
+select @@global.innodb_immediate_scrub_data_uncompressed;
+@@global.innodb_immediate_scrub_data_uncompressed
+1
+set session innodb_immediate_scrub_data_uncompressed=1;
+ERROR HY000: Variable 'innodb_immediate_scrub_data_uncompressed' is a GLOBAL variable and should be set with SET GLOBAL
+#
+# incorrect types
+#
+set global innodb_immediate_scrub_data_uncompressed=1.1;
+ERROR 42000: Incorrect argument type to variable 'innodb_immediate_scrub_data_uncompressed'
+set global innodb_immediate_scrub_data_uncompressed=1e1;
+ERROR 42000: Incorrect argument type to variable 'innodb_immediate_scrub_data_uncompressed'
+set global innodb_immediate_scrub_data_uncompressed="foo";
+ERROR 42000: Variable 'innodb_immediate_scrub_data_uncompressed' can't be set to the value of 'foo'
+SET @@global.innodb_immediate_scrub_data_uncompressed = @start_global_value;
diff --git a/mysql-test/suite/sys_vars/r/innodb_monitor_disable_basic.result b/mysql-test/suite/sys_vars/r/innodb_monitor_disable_basic.result
index 8a88b7c4d49..85fe22dd816 100644
--- a/mysql-test/suite/sys_vars/r/innodb_monitor_disable_basic.result
+++ b/mysql-test/suite/sys_vars/r/innodb_monitor_disable_basic.result
@@ -180,6 +180,9 @@ compress_page_compressed_trim_op disabled
compress_page_compressed_trim_op_saved disabled
compress_pages_page_decompressed disabled
compress_pages_page_compression_error disabled
+compress_pages_page_encrypted disabled
+compress_pages_page_decrypted disabled
+compress_pages_page_encryption_error disabled
index_page_splits disabled
index_page_merge_attempts disabled
index_page_merge_successful disabled
diff --git a/mysql-test/suite/sys_vars/r/innodb_monitor_enable_basic.result b/mysql-test/suite/sys_vars/r/innodb_monitor_enable_basic.result
index 8a88b7c4d49..85fe22dd816 100644
--- a/mysql-test/suite/sys_vars/r/innodb_monitor_enable_basic.result
+++ b/mysql-test/suite/sys_vars/r/innodb_monitor_enable_basic.result
@@ -180,6 +180,9 @@ compress_page_compressed_trim_op disabled
compress_page_compressed_trim_op_saved disabled
compress_pages_page_decompressed disabled
compress_pages_page_compression_error disabled
+compress_pages_page_encrypted disabled
+compress_pages_page_decrypted disabled
+compress_pages_page_encryption_error disabled
index_page_splits disabled
index_page_merge_attempts disabled
index_page_merge_successful disabled
diff --git a/mysql-test/suite/sys_vars/r/innodb_monitor_reset_all_basic.result b/mysql-test/suite/sys_vars/r/innodb_monitor_reset_all_basic.result
index 8a88b7c4d49..85fe22dd816 100644
--- a/mysql-test/suite/sys_vars/r/innodb_monitor_reset_all_basic.result
+++ b/mysql-test/suite/sys_vars/r/innodb_monitor_reset_all_basic.result
@@ -180,6 +180,9 @@ compress_page_compressed_trim_op disabled
compress_page_compressed_trim_op_saved disabled
compress_pages_page_decompressed disabled
compress_pages_page_compression_error disabled
+compress_pages_page_encrypted disabled
+compress_pages_page_decrypted disabled
+compress_pages_page_encryption_error disabled
index_page_splits disabled
index_page_merge_attempts disabled
index_page_merge_successful disabled
diff --git a/mysql-test/suite/sys_vars/r/innodb_monitor_reset_basic.result b/mysql-test/suite/sys_vars/r/innodb_monitor_reset_basic.result
index 8a88b7c4d49..85fe22dd816 100644
--- a/mysql-test/suite/sys_vars/r/innodb_monitor_reset_basic.result
+++ b/mysql-test/suite/sys_vars/r/innodb_monitor_reset_basic.result
@@ -180,6 +180,9 @@ compress_page_compressed_trim_op disabled
compress_page_compressed_trim_op_saved disabled
compress_pages_page_decompressed disabled
compress_pages_page_compression_error disabled
+compress_pages_page_encrypted disabled
+compress_pages_page_decrypted disabled
+compress_pages_page_encryption_error disabled
index_page_splits disabled
index_page_merge_attempts disabled
index_page_merge_successful disabled
diff --git a/mysql-test/suite/sys_vars/r/innodb_scrub_force_testing_basic.result b/mysql-test/suite/sys_vars/r/innodb_scrub_force_testing_basic.result
new file mode 100644
index 00000000000..24287efaffc
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/innodb_scrub_force_testing_basic.result
@@ -0,0 +1,50 @@
+SET @start_global_value = @@global.innodb_scrub_force_testing;
+#
+# exists as global only
+#
+select @@global.innodb_scrub_force_testing;
+@@global.innodb_scrub_force_testing
+0
+select @@session.innodb_scrub_force_testing;
+ERROR HY000: Variable 'innodb_scrub_force_testing' is a GLOBAL variable
+show global variables like 'innodb_scrub_force_testing';
+Variable_name Value
+innodb_scrub_force_testing OFF
+show session variables like 'innodb_scrub_force_testing';
+Variable_name Value
+innodb_scrub_force_testing OFF
+select * from information_schema.global_variables
+where variable_name='innodb_scrub_force_testing';
+VARIABLE_NAME VARIABLE_VALUE
+INNODB_SCRUB_FORCE_TESTING OFF
+select * from information_schema.session_variables
+where variable_name='innodb_scrub_force_testing';
+VARIABLE_NAME VARIABLE_VALUE
+INNODB_SCRUB_FORCE_TESTING OFF
+#
+# show that it's writable
+#
+set global innodb_scrub_force_testing=ON;
+select @@global.innodb_scrub_force_testing;
+@@global.innodb_scrub_force_testing
+1
+set global innodb_scrub_force_testing=OFF;
+select @@global.innodb_scrub_force_testing;
+@@global.innodb_scrub_force_testing
+0
+set global innodb_scrub_force_testing=1;
+select @@global.innodb_scrub_force_testing;
+@@global.innodb_scrub_force_testing
+1
+set session innodb_scrub_force_testing=1;
+ERROR HY000: Variable 'innodb_scrub_force_testing' is a GLOBAL variable and should be set with SET GLOBAL
+#
+# incorrect types
+#
+set global innodb_scrub_force_testing=1.1;
+ERROR 42000: Incorrect argument type to variable 'innodb_scrub_force_testing'
+set global innodb_scrub_force_testing=1e1;
+ERROR 42000: Incorrect argument type to variable 'innodb_scrub_force_testing'
+set global innodb_scrub_force_testing="foo";
+ERROR 42000: Variable 'innodb_scrub_force_testing' can't be set to the value of 'foo'
+SET @@global.innodb_scrub_force_testing = @start_global_value;
diff --git a/mysql-test/suite/sys_vars/r/innodb_scrub_log_basic.result b/mysql-test/suite/sys_vars/r/innodb_scrub_log_basic.result
new file mode 100644
index 00000000000..fc3a31fc5a2
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/innodb_scrub_log_basic.result
@@ -0,0 +1,48 @@
+SELECT @@GLOBAL.innodb_scrub_log;
+@@GLOBAL.innodb_scrub_log
+0
+0 Expected
+SET @@GLOBAL.innodb_scrub_log=1;
+ERROR HY000: Variable 'innodb_scrub_log' is a read only variable
+Expected error 'Read only variable'
+SELECT @@GLOBAL.innodb_scrub_log;
+@@GLOBAL.innodb_scrub_log
+0
+0 Expected
+SELECT IF(@@GLOBAL.innodb_scrub_log, 'ON', 'OFF') = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_scrub_log';
+IF(@@GLOBAL.innodb_scrub_log, 'ON', 'OFF') = VARIABLE_VALUE
+1
+1 Expected
+SELECT @@GLOBAL.innodb_scrub_log;
+@@GLOBAL.innodb_scrub_log
+0
+0 Expected
+SELECT VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_scrub_log';
+VARIABLE_VALUE
+OFF
+0 Expected
+SELECT @@innodb_scrub_log = @@GLOBAL.innodb_scrub_log;
+@@innodb_scrub_log = @@GLOBAL.innodb_scrub_log
+1
+1 Expected
+SELECT @@innodb_scrub_log;
+@@innodb_scrub_log
+0
+0 Expected
+SELECT @@local.innodb_scrub_log;
+ERROR HY000: Variable 'innodb_scrub_log' is a GLOBAL variable
+Expected error 'Variable is a GLOBAL variable'
+SELECT @@SESSION.innodb_scrub_log;
+ERROR HY000: Variable 'innodb_scrub_log' is a GLOBAL variable
+Expected error 'Variable is a GLOBAL variable'
+SELECT @@GLOBAL.innodb_scrub_log;
+@@GLOBAL.innodb_scrub_log
+0
+0 Expected
+SELECT innodb_scrub_log;
+ERROR 42S22: Unknown column 'innodb_scrub_log' in 'field list'
+Expected error 'Unknow column in field list'
diff --git a/mysql-test/suite/sys_vars/r/innodb_scrub_log_interval_basic.result b/mysql-test/suite/sys_vars/r/innodb_scrub_log_interval_basic.result
new file mode 100644
index 00000000000..0d7bc7e61c6
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/innodb_scrub_log_interval_basic.result
@@ -0,0 +1,53 @@
+SELECT @@GLOBAL.innodb_scrub_log_interval;
+@@GLOBAL.innodb_scrub_log_interval
+2000
+200 Expected
+SET @@GLOBAL.innodb_scrub_log_interval=100;
+1 Expected
+SELECT @@GLOBAL.innodb_scrub_log_interval;
+@@GLOBAL.innodb_scrub_log_interval
+100
+100 Expected
+SET @@GLOBAL.innodb_scrub_log_interval=DEFAULT;
+1 Expected
+SELECT @@GLOBAL.innodb_scrub_log_interval;
+@@GLOBAL.innodb_scrub_log_interval
+2000
+200 Expected
+SELECT @@GLOBAL.innodb_scrub_log_interval = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_scrub_log_interval';
+@@GLOBAL.innodb_scrub_log_interval = VARIABLE_VALUE
+1
+1 Expected
+SELECT @@GLOBAL.innodb_scrub_log_interval;
+@@GLOBAL.innodb_scrub_log_interval
+2000
+200 Expected
+SELECT VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_scrub_log_interval';
+VARIABLE_VALUE
+2000
+200 Expected
+SELECT @@innodb_scrub_log_interval = @@GLOBAL.innodb_scrub_log_interval;
+@@innodb_scrub_log_interval = @@GLOBAL.innodb_scrub_log_interval
+1
+1 Expected
+SELECT @@innodb_scrub_log_interval;
+@@innodb_scrub_log_interval
+2000
+200 Expected
+SELECT @@local.innodb_scrub_log_interval;
+ERROR HY000: Variable 'innodb_scrub_log_interval' is a GLOBAL variable
+Expected error 'Variable is a GLOBAL variable'
+SELECT @@SESSION.innodb_scrub_log_interval;
+ERROR HY000: Variable 'innodb_scrub_log_interval' is a GLOBAL variable
+Expected error 'Variable is a GLOBAL variable'
+SELECT @@GLOBAL.innodb_scrub_log_interval;
+@@GLOBAL.innodb_scrub_log_interval
+2000
+200 Expected
+SELECT innodb_scrub_log_interval;
+ERROR 42S22: Unknown column 'innodb_scrub_log_interval' in 'field list'
+Expected error 'Unknow column in field list'
diff --git a/mysql-test/suite/sys_vars/r/sysvars_aria.result b/mysql-test/suite/sys_vars/r/sysvars_aria.result
index c717fdb8203..fdaa20f414c 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_aria.result
+++ b/mysql-test/suite/sys_vars/r/sysvars_aria.result
@@ -43,6 +43,20 @@ NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
+VARIABLE_NAME ARIA_ENCRYPT_TABLES
+SESSION_VALUE NULL
+GLOBAL_VALUE OFF
+GLOBAL_VALUE_ORIGIN COMPILE-TIME
+DEFAULT_VALUE OFF
+VARIABLE_SCOPE GLOBAL
+VARIABLE_TYPE BOOLEAN
+VARIABLE_COMMENT Encrypt tables (only for tables with ROW_FORMAT=PAGE (default) and not FIXED/DYNAMIC)
+NUMERIC_MIN_VALUE NULL
+NUMERIC_MAX_VALUE NULL
+NUMERIC_BLOCK_SIZE NULL
+ENUM_VALUE_LIST NULL
+READ_ONLY NO
+COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME ARIA_FORCE_START_AFTER_RECOVERY_FAILURES
SESSION_VALUE NULL
GLOBAL_VALUE 0
diff --git a/mysql-test/suite/sys_vars/r/sysvars_debug.result b/mysql-test/suite/sys_vars/r/sysvars_debug.result
index a46e135af0a..b7f169dc22e 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_debug.result
+++ b/mysql-test/suite/sys_vars/r/sysvars_debug.result
@@ -57,6 +57,20 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
+VARIABLE_NAME DEBUG_ENCRYPTION_KEY_VERSION
+SESSION_VALUE NULL
+GLOBAL_VALUE 0
+GLOBAL_VALUE_ORIGIN COMPILE-TIME
+DEFAULT_VALUE 0
+VARIABLE_SCOPE GLOBAL
+VARIABLE_TYPE INT UNSIGNED
+VARIABLE_COMMENT Encryption key version. Only to be used in internal testing.
+NUMERIC_MIN_VALUE 0
+NUMERIC_MAX_VALUE 4294967295
+NUMERIC_BLOCK_SIZE 1
+ENUM_VALUE_LIST NULL
+READ_ONLY NO
+COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME DEBUG_MUTEX_DEADLOCK_DETECTOR
SESSION_VALUE NULL
GLOBAL_VALUE ON
@@ -99,3 +113,17 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT NULL
+VARIABLE_NAME DEBUG_USE_STATIC_ENCRYPTION_KEYS
+SESSION_VALUE NULL
+GLOBAL_VALUE OFF
+GLOBAL_VALUE_ORIGIN COMPILE-TIME
+DEFAULT_VALUE OFF
+VARIABLE_SCOPE GLOBAL
+VARIABLE_TYPE BOOLEAN
+VARIABLE_COMMENT Enable use of nonrandom encryption keys. Only to be used in internal testing
+NUMERIC_MIN_VALUE NULL
+NUMERIC_MAX_VALUE NULL
+NUMERIC_BLOCK_SIZE NULL
+ENUM_VALUE_LIST OFF,ON
+READ_ONLY YES
+COMMAND_LINE_ARGUMENT OPTIONAL
diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb.result b/mysql-test/suite/sys_vars/r/sysvars_innodb.result
index 3ee4a09b954..966187a61ab 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_innodb.result
+++ b/mysql-test/suite/sys_vars/r/sysvars_innodb.result
@@ -173,6 +173,62 @@ NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
+VARIABLE_NAME INNODB_BACKGROUND_SCRUB_DATA_CHECK_INTERVAL
+SESSION_VALUE NULL
+GLOBAL_VALUE 3600
+GLOBAL_VALUE_ORIGIN COMPILE-TIME
+DEFAULT_VALUE 3600
+VARIABLE_SCOPE GLOBAL
+VARIABLE_TYPE INT UNSIGNED
+VARIABLE_COMMENT check if spaces needs scrubbing every innodb_background_scrub_data_check_interval seconds
+NUMERIC_MIN_VALUE 1
+NUMERIC_MAX_VALUE 4294967295
+NUMERIC_BLOCK_SIZE 0
+ENUM_VALUE_LIST NULL
+READ_ONLY NO
+COMMAND_LINE_ARGUMENT REQUIRED
+VARIABLE_NAME INNODB_BACKGROUND_SCRUB_DATA_COMPRESSED
+SESSION_VALUE NULL
+GLOBAL_VALUE OFF
+GLOBAL_VALUE_ORIGIN COMPILE-TIME
+DEFAULT_VALUE OFF
+VARIABLE_SCOPE GLOBAL
+VARIABLE_TYPE BOOLEAN
+VARIABLE_COMMENT Enable scrubbing of compressed data by background threads (same as encryption_threads)
+NUMERIC_MIN_VALUE NULL
+NUMERIC_MAX_VALUE NULL
+NUMERIC_BLOCK_SIZE NULL
+ENUM_VALUE_LIST NULL
+READ_ONLY NO
+COMMAND_LINE_ARGUMENT REQUIRED
+VARIABLE_NAME INNODB_BACKGROUND_SCRUB_DATA_INTERVAL
+SESSION_VALUE NULL
+GLOBAL_VALUE 604800
+GLOBAL_VALUE_ORIGIN COMPILE-TIME
+DEFAULT_VALUE 604800
+VARIABLE_SCOPE GLOBAL
+VARIABLE_TYPE INT UNSIGNED
+VARIABLE_COMMENT scrub spaces that were last scrubbed longer than innodb_background_scrub_data_interval seconds ago
+NUMERIC_MIN_VALUE 1
+NUMERIC_MAX_VALUE 4294967295
+NUMERIC_BLOCK_SIZE 0
+ENUM_VALUE_LIST NULL
+READ_ONLY NO
+COMMAND_LINE_ARGUMENT REQUIRED
+VARIABLE_NAME INNODB_BACKGROUND_SCRUB_DATA_UNCOMPRESSED
+SESSION_VALUE NULL
+GLOBAL_VALUE OFF
+GLOBAL_VALUE_ORIGIN COMPILE-TIME
+DEFAULT_VALUE OFF
+VARIABLE_SCOPE GLOBAL
+VARIABLE_TYPE BOOLEAN
+VARIABLE_COMMENT Enable scrubbing of uncompressed data by background threads (same as encryption_threads)
+NUMERIC_MIN_VALUE NULL
+NUMERIC_MAX_VALUE NULL
+NUMERIC_BLOCK_SIZE NULL
+ENUM_VALUE_LIST NULL
+READ_ONLY NO
+COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME INNODB_BUFFER_POOL_DUMP_AT_SHUTDOWN
SESSION_VALUE NULL
GLOBAL_VALUE OFF
@@ -649,6 +705,76 @@ NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
READ_ONLY YES
COMMAND_LINE_ARGUMENT OPTIONAL
+VARIABLE_NAME INNODB_ENCRYPTION_ROTATE_KEY_AGE
+SESSION_VALUE NULL
+GLOBAL_VALUE 1
+GLOBAL_VALUE_ORIGIN COMPILE-TIME
+DEFAULT_VALUE 1
+VARIABLE_SCOPE GLOBAL
+VARIABLE_TYPE INT UNSIGNED
+VARIABLE_COMMENT Rotate any page having a key older than this
+NUMERIC_MIN_VALUE 0
+NUMERIC_MAX_VALUE 4294967295
+NUMERIC_BLOCK_SIZE 0
+ENUM_VALUE_LIST NULL
+READ_ONLY NO
+COMMAND_LINE_ARGUMENT REQUIRED
+VARIABLE_NAME INNODB_ENCRYPTION_ROTATION_IOPS
+SESSION_VALUE NULL
+GLOBAL_VALUE 100
+GLOBAL_VALUE_ORIGIN COMPILE-TIME
+DEFAULT_VALUE 100
+VARIABLE_SCOPE GLOBAL
+VARIABLE_TYPE INT UNSIGNED
+VARIABLE_COMMENT Use this many iops for background key rotation
+NUMERIC_MIN_VALUE 0
+NUMERIC_MAX_VALUE 4294967295
+NUMERIC_BLOCK_SIZE 0
+ENUM_VALUE_LIST NULL
+READ_ONLY NO
+COMMAND_LINE_ARGUMENT REQUIRED
+VARIABLE_NAME INNODB_ENCRYPTION_THREADS
+SESSION_VALUE NULL
+GLOBAL_VALUE 0
+GLOBAL_VALUE_ORIGIN COMPILE-TIME
+DEFAULT_VALUE 0
+VARIABLE_SCOPE GLOBAL
+VARIABLE_TYPE INT UNSIGNED
+VARIABLE_COMMENT No of threads performing background key rotation and scrubbing
+NUMERIC_MIN_VALUE 0
+NUMERIC_MAX_VALUE 4294967295
+NUMERIC_BLOCK_SIZE 0
+ENUM_VALUE_LIST NULL
+READ_ONLY NO
+COMMAND_LINE_ARGUMENT REQUIRED
+VARIABLE_NAME INNODB_ENCRYPT_LOG
+SESSION_VALUE NULL
+GLOBAL_VALUE OFF
+GLOBAL_VALUE_ORIGIN COMPILE-TIME
+DEFAULT_VALUE OFF
+VARIABLE_SCOPE GLOBAL
+VARIABLE_TYPE BOOLEAN
+VARIABLE_COMMENT Enable redo log encryption/decryption.
+NUMERIC_MIN_VALUE NULL
+NUMERIC_MAX_VALUE NULL
+NUMERIC_BLOCK_SIZE NULL
+ENUM_VALUE_LIST NULL
+READ_ONLY YES
+COMMAND_LINE_ARGUMENT OPTIONAL
+VARIABLE_NAME INNODB_ENCRYPT_TABLES
+SESSION_VALUE NULL
+GLOBAL_VALUE OFF
+GLOBAL_VALUE_ORIGIN COMPILE-TIME
+DEFAULT_VALUE OFF
+VARIABLE_SCOPE GLOBAL
+VARIABLE_TYPE BOOLEAN
+VARIABLE_COMMENT Encrypt all tables in the storage engine
+NUMERIC_MIN_VALUE NULL
+NUMERIC_MAX_VALUE NULL
+NUMERIC_BLOCK_SIZE NULL
+ENUM_VALUE_LIST NULL
+READ_ONLY NO
+COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME INNODB_FAST_SHUTDOWN
SESSION_VALUE NULL
GLOBAL_VALUE 1
@@ -1055,6 +1181,20 @@ NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
+VARIABLE_NAME INNODB_IMMEDIATE_SCRUB_DATA_UNCOMPRESSED
+SESSION_VALUE NULL
+GLOBAL_VALUE OFF
+GLOBAL_VALUE_ORIGIN COMPILE-TIME
+DEFAULT_VALUE OFF
+VARIABLE_SCOPE GLOBAL
+VARIABLE_TYPE BOOLEAN
+VARIABLE_COMMENT Enable scrubbing of data
+NUMERIC_MIN_VALUE NULL
+NUMERIC_MAX_VALUE NULL
+NUMERIC_BLOCK_SIZE NULL
+ENUM_VALUE_LIST NULL
+READ_ONLY NO
+COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME INNODB_IO_CAPACITY
SESSION_VALUE NULL
GLOBAL_VALUE 200
@@ -1671,6 +1811,48 @@ NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
+VARIABLE_NAME INNODB_SCRUB_FORCE_TESTING
+SESSION_VALUE NULL
+GLOBAL_VALUE OFF
+GLOBAL_VALUE_ORIGIN COMPILE-TIME
+DEFAULT_VALUE OFF
+VARIABLE_SCOPE GLOBAL
+VARIABLE_TYPE BOOLEAN
+VARIABLE_COMMENT Perform extra scrubbing to increase test exposure
+NUMERIC_MIN_VALUE NULL
+NUMERIC_MAX_VALUE NULL
+NUMERIC_BLOCK_SIZE NULL
+ENUM_VALUE_LIST NULL
+READ_ONLY NO
+COMMAND_LINE_ARGUMENT REQUIRED
+VARIABLE_NAME INNODB_SCRUB_LOG
+SESSION_VALUE NULL
+GLOBAL_VALUE OFF
+GLOBAL_VALUE_ORIGIN COMPILE-TIME
+DEFAULT_VALUE OFF
+VARIABLE_SCOPE GLOBAL
+VARIABLE_TYPE BOOLEAN
+VARIABLE_COMMENT Enable redo log scrubbing
+NUMERIC_MIN_VALUE NULL
+NUMERIC_MAX_VALUE NULL
+NUMERIC_BLOCK_SIZE NULL
+ENUM_VALUE_LIST NULL
+READ_ONLY YES
+COMMAND_LINE_ARGUMENT OPTIONAL
+VARIABLE_NAME INNODB_SCRUB_LOG_INTERVAL
+SESSION_VALUE NULL
+GLOBAL_VALUE 2000
+GLOBAL_VALUE_ORIGIN COMPILE-TIME
+DEFAULT_VALUE 2000
+VARIABLE_SCOPE GLOBAL
+VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_COMMENT Innodb redo log scrubbing interval in ms
+NUMERIC_MIN_VALUE 10
+NUMERIC_MAX_VALUE 18446744073709551615
+NUMERIC_BLOCK_SIZE 0
+ENUM_VALUE_LIST NULL
+READ_ONLY NO
+COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME INNODB_SIMULATE_COMP_FAILURES
SESSION_VALUE NULL
GLOBAL_VALUE 0
diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result
index 2bf6814633f..48e5fd621e9 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result
+++ b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result
@@ -679,6 +679,34 @@ NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
+VARIABLE_NAME ENCRYPTION_ALGORITHM
+SESSION_VALUE NULL
+GLOBAL_VALUE none
+GLOBAL_VALUE_ORIGIN COMPILE-TIME
+DEFAULT_VALUE none
+VARIABLE_SCOPE GLOBAL
+VARIABLE_TYPE ENUM
+VARIABLE_COMMENT Which encryption algorithm to use for table encryption. aes_cbc is the recommended one.
+NUMERIC_MIN_VALUE NULL
+NUMERIC_MAX_VALUE NULL
+NUMERIC_BLOCK_SIZE NULL
+ENUM_VALUE_LIST none,aes_ecb,aes_cbc,aes_ctr
+READ_ONLY YES
+COMMAND_LINE_ARGUMENT REQUIRED
+VARIABLE_NAME ENCRYPT_TMP_DISK_TABLES
+SESSION_VALUE NULL
+GLOBAL_VALUE OFF
+GLOBAL_VALUE_ORIGIN COMPILE-TIME
+DEFAULT_VALUE OFF
+VARIABLE_SCOPE GLOBAL
+VARIABLE_TYPE BOOLEAN
+VARIABLE_COMMENT Encrypt tmp disk tables (created as part of query execution)
+NUMERIC_MIN_VALUE NULL
+NUMERIC_MAX_VALUE NULL
+NUMERIC_BLOCK_SIZE NULL
+ENUM_VALUE_LIST OFF,ON
+READ_ONLY NO
+COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME ERROR_COUNT
SESSION_VALUE 0
GLOBAL_VALUE NULL
diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result
index 0f3b71b1421..00f11a87792 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result
+++ b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result
@@ -693,6 +693,34 @@ NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
+VARIABLE_NAME ENCRYPTION_ALGORITHM
+SESSION_VALUE NULL
+GLOBAL_VALUE none
+GLOBAL_VALUE_ORIGIN COMPILE-TIME
+DEFAULT_VALUE none
+VARIABLE_SCOPE GLOBAL
+VARIABLE_TYPE ENUM
+VARIABLE_COMMENT Which encryption algorithm to use for table encryption. aes_cbc is the recommended one.
+NUMERIC_MIN_VALUE NULL
+NUMERIC_MAX_VALUE NULL
+NUMERIC_BLOCK_SIZE NULL
+ENUM_VALUE_LIST none,aes_ecb,aes_cbc,aes_ctr
+READ_ONLY YES
+COMMAND_LINE_ARGUMENT REQUIRED
+VARIABLE_NAME ENCRYPT_TMP_DISK_TABLES
+SESSION_VALUE NULL
+GLOBAL_VALUE OFF
+GLOBAL_VALUE_ORIGIN COMPILE-TIME
+DEFAULT_VALUE OFF
+VARIABLE_SCOPE GLOBAL
+VARIABLE_TYPE BOOLEAN
+VARIABLE_COMMENT Encrypt tmp disk tables (created as part of query execution)
+NUMERIC_MIN_VALUE NULL
+NUMERIC_MAX_VALUE NULL
+NUMERIC_BLOCK_SIZE NULL
+ENUM_VALUE_LIST OFF,ON
+READ_ONLY NO
+COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME ERROR_COUNT
SESSION_VALUE 0
GLOBAL_VALUE NULL
diff --git a/mysql-test/suite/sys_vars/t/aria_encrypt_tables_basic.test b/mysql-test/suite/sys_vars/t/aria_encrypt_tables_basic.test
new file mode 100644
index 00000000000..2db0708e925
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/aria_encrypt_tables_basic.test
@@ -0,0 +1,41 @@
+# bool global
+--source include/have_maria.inc
+
+SET @start_global_value = @@global.aria_encrypt_tables;
+
+#
+# exists as global only
+#
+select @@global.aria_encrypt_tables;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.aria_encrypt_tables;
+show global variables like 'aria_encrypt_tables';
+show session variables like 'aria_encrypt_tables';
+select * from information_schema.global_variables
+where variable_name='aria_encrypt_tables';
+select * from information_schema.session_variables
+where variable_name='aria_encrypt_tables';
+
+#
+# show that it's writable
+#
+set global aria_encrypt_tables=ON;
+select @@global.aria_encrypt_tables;
+set global aria_encrypt_tables=OFF;
+select @@global.aria_encrypt_tables;
+set global aria_encrypt_tables=1;
+select @@global.aria_encrypt_tables;
+--error ER_GLOBAL_VARIABLE
+set session aria_encrypt_tables=1;
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global aria_encrypt_tables=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global aria_encrypt_tables=1e1;
+--error ER_WRONG_VALUE_FOR_VAR
+set global aria_encrypt_tables="foo";
+
+SET @@global.aria_encrypt_tables = @start_global_value;
diff --git a/mysql-test/suite/sys_vars/t/debug_encryption_key_version_basic.test b/mysql-test/suite/sys_vars/t/debug_encryption_key_version_basic.test
new file mode 100644
index 00000000000..007724b0966
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/debug_encryption_key_version_basic.test
@@ -0,0 +1,3 @@
+--source include/have_debug.inc
+# This is just to satisfy all_vars
+select 1;
diff --git a/mysql-test/suite/sys_vars/t/debug_use_static_encryption_keys_basic.test b/mysql-test/suite/sys_vars/t/debug_use_static_encryption_keys_basic.test
new file mode 100644
index 00000000000..2e0d51e89b7
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/debug_use_static_encryption_keys_basic.test
@@ -0,0 +1,3 @@
+# This is just to satisfy all_vars
+--source include/have_debug.inc
+show global variables like "debug_use_static_encryption_keys";
diff --git a/mysql-test/suite/sys_vars/t/encrypt_tmp_disk_tables_basic.test b/mysql-test/suite/sys_vars/t/encrypt_tmp_disk_tables_basic.test
new file mode 100644
index 00000000000..ee01e6d8ba4
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/encrypt_tmp_disk_tables_basic.test
@@ -0,0 +1,41 @@
+# bool global
+--source include/have_maria.inc
+
+SET @start_global_value = @@global.encrypt_tmp_disk_tables;
+
+#
+# exists as global only
+#
+select @@global.encrypt_tmp_disk_tables;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.encrypt_tmp_disk_tables;
+show global variables like 'encrypt_tmp_disk_tables';
+show session variables like 'encrypt_tmp_disk_tables';
+select * from information_schema.global_variables
+where variable_name='encrypt_tmp_disk_tables';
+select * from information_schema.session_variables
+where variable_name='encrypt_tmp_disk_tables';
+
+#
+# show that it's writable
+#
+set global encrypt_tmp_disk_tables=ON;
+select @@global.encrypt_tmp_disk_tables;
+set global encrypt_tmp_disk_tables=OFF;
+select @@global.encrypt_tmp_disk_tables;
+set global encrypt_tmp_disk_tables=1;
+select @@global.encrypt_tmp_disk_tables;
+--error ER_GLOBAL_VARIABLE
+set session encrypt_tmp_disk_tables=1;
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global encrypt_tmp_disk_tables=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global encrypt_tmp_disk_tables=1e1;
+--error ER_WRONG_VALUE_FOR_VAR
+set global encrypt_tmp_disk_tables="foo";
+
+SET @@global.encrypt_tmp_disk_tables = @start_global_value;
diff --git a/mysql-test/suite/sys_vars/t/encryption_algorithm_basic.test b/mysql-test/suite/sys_vars/t/encryption_algorithm_basic.test
new file mode 100644
index 00000000000..065453eba34
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/encryption_algorithm_basic.test
@@ -0,0 +1,13 @@
+# bool global
+
+# exists as global only
+#
+select @@global.encryption_algorithm;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.encryption_algorithm;
+
+#
+# show that it's not writable
+#
+--error 1238
+set global encryption_algorithm="none";
diff --git a/mysql-test/suite/sys_vars/t/innodb_background_scrub_data_check_interval_basic.test b/mysql-test/suite/sys_vars/t/innodb_background_scrub_data_check_interval_basic.test
new file mode 100644
index 00000000000..77c8671a1bc
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_background_scrub_data_check_interval_basic.test
@@ -0,0 +1,54 @@
+# bool global
+--source include/have_innodb.inc
+
+SET @start_global_value = @@global.innodb_background_scrub_data_check_interval;
+
+--echo #
+--echo # default value
+--echo #
+select @@global.innodb_background_scrub_data_check_interval;
+set global innodb_background_scrub_data_check_interval=10;
+select @@global.innodb_background_scrub_data_check_interval;
+set global innodb_background_scrub_data_check_interval=DEFAULT;
+select @@global.innodb_background_scrub_data_check_interval;
+set global innodb_background_scrub_data_check_interval=20;
+select @@global.innodb_background_scrub_data_check_interval;
+set global innodb_background_scrub_data_check_interval=DEFAULT;
+select @@global.innodb_background_scrub_data_check_interval;
+
+--echo #
+--echo # exists as global only
+--echo #
+select @@global.innodb_background_scrub_data_check_interval;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_background_scrub_data_check_interval;
+show global variables like 'innodb_background_scrub_data_check_interval';
+show session variables like 'innodb_background_scrub_data_check_interval';
+select * from information_schema.global_variables
+where variable_name='innodb_background_scrub_data_check_interval';
+select * from information_schema.session_variables
+where variable_name='innodb_background_scrub_data_check_interval';
+
+--echo #
+--echo # show that it's writable
+--echo #
+set global innodb_background_scrub_data_check_interval=10;
+select @@global.innodb_background_scrub_data_check_interval;
+set global innodb_background_scrub_data_check_interval=20;
+select @@global.innodb_background_scrub_data_check_interval;
+set global innodb_background_scrub_data_check_interval=1;
+select @@global.innodb_background_scrub_data_check_interval;
+--error ER_GLOBAL_VARIABLE
+set session innodb_background_scrub_data_check_interval=1;
+
+--echo #
+--echo # incorrect types
+--echo #
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_background_scrub_data_check_interval=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_background_scrub_data_check_interval=1e1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_background_scrub_data_check_interval="foo";
+
+SET @@global.innodb_background_scrub_data_check_interval = @start_global_value;
diff --git a/mysql-test/suite/sys_vars/t/innodb_background_scrub_data_compressed_basic.test b/mysql-test/suite/sys_vars/t/innodb_background_scrub_data_compressed_basic.test
new file mode 100644
index 00000000000..fdf77bbb780
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_background_scrub_data_compressed_basic.test
@@ -0,0 +1,41 @@
+# bool global
+--source include/have_innodb.inc
+
+SET @start_global_value = @@global.innodb_background_scrub_data_compressed;
+
+--echo #
+--echo # exists as global only
+--echo #
+select @@global.innodb_background_scrub_data_compressed;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_background_scrub_data_compressed;
+show global variables like 'innodb_background_scrub_data_compressed';
+show session variables like 'innodb_background_scrub_data_compressed';
+select * from information_schema.global_variables
+where variable_name='innodb_background_scrub_data_compressed';
+select * from information_schema.session_variables
+where variable_name='innodb_background_scrub_data_compressed';
+
+--echo #
+--echo # show that it's writable
+--echo #
+set global innodb_background_scrub_data_compressed=ON;
+select @@global.innodb_background_scrub_data_compressed;
+set global innodb_background_scrub_data_compressed=OFF;
+select @@global.innodb_background_scrub_data_compressed;
+set global innodb_background_scrub_data_compressed=1;
+select @@global.innodb_background_scrub_data_compressed;
+--error ER_GLOBAL_VARIABLE
+set session innodb_background_scrub_data_compressed=1;
+
+--echo #
+--echo # incorrect types
+--echo #
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_background_scrub_data_compressed=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_background_scrub_data_compressed=1e1;
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_background_scrub_data_compressed="foo";
+
+SET @@global.innodb_background_scrub_data_compressed = @start_global_value;
diff --git a/mysql-test/suite/sys_vars/t/innodb_background_scrub_data_interval_basic.test b/mysql-test/suite/sys_vars/t/innodb_background_scrub_data_interval_basic.test
new file mode 100644
index 00000000000..9f1187a97ff
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_background_scrub_data_interval_basic.test
@@ -0,0 +1,41 @@
+# bool global
+--source include/have_innodb.inc
+
+SET @start_global_value = @@global.innodb_background_scrub_data_interval;
+
+--echo #
+--echo # exists as global only
+--echo #
+select @@global.innodb_background_scrub_data_interval;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_background_scrub_data_interval;
+show global variables like 'innodb_background_scrub_data_interval';
+show session variables like 'innodb_background_scrub_data_interval';
+select * from information_schema.global_variables
+where variable_name='innodb_background_scrub_data_interval';
+select * from information_schema.session_variables
+where variable_name='innodb_background_scrub_data_interval';
+
+--echo #
+--echo # show that it's writable
+--echo #
+set global innodb_background_scrub_data_interval=100;
+select @@global.innodb_background_scrub_data_interval;
+set global innodb_background_scrub_data_interval=200;
+select @@global.innodb_background_scrub_data_interval;
+set global innodb_background_scrub_data_interval=300;
+select @@global.innodb_background_scrub_data_interval;
+--error ER_GLOBAL_VARIABLE
+set session innodb_background_scrub_data_interval=400;
+
+--echo #
+--echo # incorrect types
+--echo #
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_background_scrub_data_interval=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_background_scrub_data_interval=1e1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_background_scrub_data_interval="foo";
+
+SET @@global.innodb_background_scrub_data_interval = @start_global_value;
diff --git a/mysql-test/suite/sys_vars/t/innodb_background_scrub_data_uncompressed_basic.test b/mysql-test/suite/sys_vars/t/innodb_background_scrub_data_uncompressed_basic.test
new file mode 100644
index 00000000000..76d6535ad81
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_background_scrub_data_uncompressed_basic.test
@@ -0,0 +1,41 @@
+# bool global
+--source include/have_innodb.inc
+
+SET @start_global_value = @@global.innodb_background_scrub_data_uncompressed;
+
+--echo #
+--echo # exists as global only
+--echo #
+select @@global.innodb_background_scrub_data_uncompressed;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_background_scrub_data_uncompressed;
+show global variables like 'innodb_background_scrub_data_uncompressed';
+show session variables like 'innodb_background_scrub_data_uncompressed';
+select * from information_schema.global_variables
+where variable_name='innodb_background_scrub_data_uncompressed';
+select * from information_schema.session_variables
+where variable_name='innodb_background_scrub_data_uncompressed';
+
+--echo #
+--echo # show that it's writable
+--echo #
+set global innodb_background_scrub_data_uncompressed=ON;
+select @@global.innodb_background_scrub_data_uncompressed;
+set global innodb_background_scrub_data_uncompressed=OFF;
+select @@global.innodb_background_scrub_data_uncompressed;
+set global innodb_background_scrub_data_uncompressed=1;
+select @@global.innodb_background_scrub_data_uncompressed;
+--error ER_GLOBAL_VARIABLE
+set session innodb_background_scrub_data_uncompressed=1;
+
+--echo #
+--echo # incorrect types
+--echo #
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_background_scrub_data_uncompressed=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_background_scrub_data_uncompressed=1e1;
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_background_scrub_data_uncompressed="foo";
+
+SET @@global.innodb_background_scrub_data_uncompressed = @start_global_value;
diff --git a/mysql-test/suite/sys_vars/t/innodb_checksum_algorithm_basic.test b/mysql-test/suite/sys_vars/t/innodb_checksum_algorithm_basic.test
index bb0f3417f87..e7098b7e3b3 100644
--- a/mysql-test/suite/sys_vars/t/innodb_checksum_algorithm_basic.test
+++ b/mysql-test/suite/sys_vars/t/innodb_checksum_algorithm_basic.test
@@ -1,4 +1,5 @@
--source include/have_innodb.inc
+--source include/not_encrypted.inc
# Check the default value
SET @orig = @@global.innodb_checksum_algorithm;
diff --git a/mysql-test/suite/sys_vars/t/innodb_data_encryption_filekey_basic.test b/mysql-test/suite/sys_vars/t/innodb_data_encryption_filekey_basic.test
new file mode 100644
index 00000000000..a35be702c25
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_data_encryption_filekey_basic.test
@@ -0,0 +1,14 @@
+--source include/have_innodb.inc
+--source include/have_innodb_encryption.inc
+
+SELECT @start_data_encryption_filekey;
+
+SELECT COUNT(@@GLOBAL.innodb_data_encryption_filekey);
+--echo 1 Expected
+
+# This variable is read only variable
+--error 1238
+SET @@GLOBAL.innodb_data_encryption_filekey='secret';
+
+
+
diff --git a/mysql-test/suite/sys_vars/t/innodb_data_encryption_providername_basic.test b/mysql-test/suite/sys_vars/t/innodb_data_encryption_providername_basic.test
new file mode 100644
index 00000000000..80e8282af8f
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_data_encryption_providername_basic.test
@@ -0,0 +1,11 @@
+--source include/have_innodb.inc
+--source include/have_innodb_encryption.inc
+
+SELECT @start_data_encryption_providername;
+
+SELECT COUNT(@@GLOBAL.innodb_data_encryption_providername);
+--echo 1 Expected
+
+# This variable is read only variable
+--error 1238
+SET @@GLOBAL.innodb_data_encryption_providername='key.txt';
diff --git a/mysql-test/suite/sys_vars/t/innodb_data_encryption_providertype_basic.test b/mysql-test/suite/sys_vars/t/innodb_data_encryption_providertype_basic.test
new file mode 100644
index 00000000000..7e841a27d27
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_data_encryption_providertype_basic.test
@@ -0,0 +1,16 @@
+--source include/have_innodb.inc
+--source include/have_innodb_encryption.inc
+
+SELECT @start_data_encryption_providertype;
+
+SELECT COUNT(@@GLOBAL.innodb_data_encryption_providertype);
+--echo 1 Expected
+
+# This variable is read only variable
+--error 1238
+SET @@GLOBAL.innodb_data_encryption_providertype=1;
+
+# This variable is read only variable
+--error 1238
+SET @@GLOBAL.innodb_data_encryption_providertype=k;
+
diff --git a/mysql-test/suite/sys_vars/t/innodb_data_encryption_providerurl_basic.test b/mysql-test/suite/sys_vars/t/innodb_data_encryption_providerurl_basic.test
new file mode 100644
index 00000000000..d742fe2aa06
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_data_encryption_providerurl_basic.test
@@ -0,0 +1,14 @@
+--source include/have_innodb.inc
+--source include/have_innodb_encryption.inc
+
+SELECT @start_data_encryption_providerurl;
+
+SELECT COUNT(@@GLOBAL.innodb_data_encryption_providerurl);
+--echo 1 Expected
+
+# This variable is read only variable
+--error 1238
+SET @@GLOBAL.innodb_data_encryption_providerurl='http://www.google.com';
+
+
+
diff --git a/mysql-test/suite/sys_vars/t/innodb_encrypt_log_basic.test b/mysql-test/suite/sys_vars/t/innodb_encrypt_log_basic.test
new file mode 100644
index 00000000000..775e8a3b944
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_encrypt_log_basic.test
@@ -0,0 +1,50 @@
+--source include/have_innodb.inc
+
+# Display default value
+SELECT @@GLOBAL.innodb_encrypt_log;
+--echo 0 Expected
+
+# Check if value can be set
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@GLOBAL.innodb_encrypt_log=1;
+--echo Expected error 'Read only variable'
+
+SELECT @@GLOBAL.innodb_encrypt_log;
+--echo 0 Expected
+
+# Check if the value in GLOBAL TABLE matches value in variable
+SELECT IF(@@GLOBAL.innodb_encrypt_log, 'ON', 'OFF') = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_encrypt_log';
+--echo 1 Expected
+
+SELECT @@GLOBAL.innodb_encrypt_log;
+--echo 0 Expected
+
+SELECT VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_encrypt_log';
+--echo 0 Expected
+
+# Check if accessing variable with and without GLOBAL point to same variable
+SELECT @@innodb_encrypt_log = @@GLOBAL.innodb_encrypt_log;
+--echo 1 Expected
+
+# Check if innodb_encrypt_log can be accessed with and without @@ sign
+SELECT @@innodb_encrypt_log;
+--echo 0 Expected
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@local.innodb_encrypt_log);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@SESSION.innodb_encrypt_log);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+SELECT @@GLOBAL.innodb_encrypt_log;
+--echo 0 Expected
+
+--Error ER_BAD_FIELD_ERROR
+SELECT innodb_encrypt_log;
+--echo Expected error 'Unknown column in field list'
diff --git a/mysql-test/suite/sys_vars/t/innodb_encrypt_tables_basic.test b/mysql-test/suite/sys_vars/t/innodb_encrypt_tables_basic.test
new file mode 100644
index 00000000000..6d6c6b94c0f
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_encrypt_tables_basic.test
@@ -0,0 +1,41 @@
+# bool global
+--source include/have_innodb.inc
+
+SET @start_global_value = @@global.innodb_encrypt_tables;
+
+#
+# exists as global only
+#
+select @@global.innodb_encrypt_tables;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_encrypt_tables;
+show global variables like 'innodb_encrypt_tables';
+show session variables like 'innodb_encrypt_tables';
+select * from information_schema.global_variables
+where variable_name='innodb_encrypt_tables';
+select * from information_schema.session_variables
+where variable_name='innodb_encrypt_tables';
+
+#
+# show that it's writable
+#
+set global innodb_encrypt_tables=ON;
+select @@global.innodb_encrypt_tables;
+set global innodb_encrypt_tables=OFF;
+select @@global.innodb_encrypt_tables;
+set global innodb_encrypt_tables=1;
+select @@global.innodb_encrypt_tables;
+--error ER_GLOBAL_VARIABLE
+set session innodb_encrypt_tables=1;
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_encrypt_tables=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_encrypt_tables=1e1;
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_encrypt_tables="foo";
+
+SET @@global.innodb_encrypt_tables = @start_global_value;
diff --git a/mysql-test/suite/sys_vars/t/innodb_encryption_rotate_key_age_basic.test b/mysql-test/suite/sys_vars/t/innodb_encryption_rotate_key_age_basic.test
new file mode 100644
index 00000000000..51112886130
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_encryption_rotate_key_age_basic.test
@@ -0,0 +1,41 @@
+# bool global
+--source include/have_innodb.inc
+
+SET @start_global_value = @@global.innodb_encryption_rotate_key_age;
+
+#
+# exists as global only
+#
+select @@global.innodb_encryption_rotate_key_age;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_encryption_rotate_key_age;
+show global variables like 'innodb_encryption_rotate_key_age';
+show session variables like 'innodb_encryption_rotate_key_age';
+select * from information_schema.global_variables
+where variable_name='innodb_encryption_rotate_key_age';
+select * from information_schema.session_variables
+where variable_name='innodb_encryption_rotate_key_age';
+
+#
+# show that it's writable
+#
+set global innodb_encryption_rotate_key_age=1;
+select @@global.innodb_encryption_rotate_key_age;
+set global innodb_encryption_rotate_key_age=2;
+select @@global.innodb_encryption_rotate_key_age;
+set global innodb_encryption_rotate_key_age=1;
+select @@global.innodb_encryption_rotate_key_age;
+--error ER_GLOBAL_VARIABLE
+set session innodb_encryption_rotate_key_age=1;
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_encryption_rotate_key_age=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_encryption_rotate_key_age=1e1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_encryption_rotate_key_age="foo";
+
+SET @@global.innodb_encryption_rotate_key_age = @start_global_value;
diff --git a/mysql-test/suite/sys_vars/t/innodb_encryption_rotation_iops_basic.test b/mysql-test/suite/sys_vars/t/innodb_encryption_rotation_iops_basic.test
new file mode 100644
index 00000000000..cdbada6c5c8
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_encryption_rotation_iops_basic.test
@@ -0,0 +1,41 @@
+# bool global
+--source include/have_innodb.inc
+
+SET @start_global_value = @@global.innodb_encryption_rotation_iops;
+
+#
+# exists as global only
+#
+select @@global.innodb_encryption_rotation_iops;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_encryption_rotation_iops;
+show global variables like 'innodb_encryption_rotation_iops';
+show session variables like 'innodb_encryption_rotation_iops';
+select * from information_schema.global_variables
+where variable_name='innodb_encryption_rotation_iops';
+select * from information_schema.session_variables
+where variable_name='innodb_encryption_rotation_iops';
+
+#
+# show that it's writable
+#
+set global innodb_encryption_rotation_iops=100;
+select @@global.innodb_encryption_rotation_iops;
+set global innodb_encryption_rotation_iops=50;
+select @@global.innodb_encryption_rotation_iops;
+set global innodb_encryption_rotation_iops=100;
+select @@global.innodb_encryption_rotation_iops;
+--error ER_GLOBAL_VARIABLE
+set session innodb_encryption_rotation_iops=50;
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_encryption_rotation_iops=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_encryption_rotation_iops=1e1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_encryption_rotation_iops="foo";
+
+SET @@global.innodb_encryption_rotation_iops = @start_global_value;
diff --git a/mysql-test/suite/sys_vars/t/innodb_encryption_threads_basic.test b/mysql-test/suite/sys_vars/t/innodb_encryption_threads_basic.test
new file mode 100644
index 00000000000..c3e163faef4
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_encryption_threads_basic.test
@@ -0,0 +1,41 @@
+# bool global
+--source include/have_innodb.inc
+
+SET @start_global_value = @@global.innodb_encryption_threads;
+
+#
+# exists as global only
+#
+select @@global.innodb_encryption_threads;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_encryption_threads;
+show global variables like 'innodb_encryption_threads';
+show session variables like 'innodb_encryption_threads';
+select * from information_schema.global_variables
+where variable_name='innodb_encryption_threads';
+select * from information_schema.session_variables
+where variable_name='innodb_encryption_threads';
+
+#
+# show that it's writable
+#
+set global innodb_encryption_threads=0;
+select @@global.innodb_encryption_threads;
+set global innodb_encryption_threads=5;
+select @@global.innodb_encryption_threads;
+set global innodb_encryption_threads=1;
+select @@global.innodb_encryption_threads;
+--error ER_GLOBAL_VARIABLE
+set session innodb_encryption_threads=1;
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_encryption_threads=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_encryption_threads=1e1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_encryption_threads="foo";
+
+SET @@global.innodb_encryption_threads = @start_global_value;
diff --git a/mysql-test/suite/sys_vars/t/innodb_immediate_scrub_data_uncompressed_basic.test b/mysql-test/suite/sys_vars/t/innodb_immediate_scrub_data_uncompressed_basic.test
new file mode 100644
index 00000000000..f3a3fba153a
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_immediate_scrub_data_uncompressed_basic.test
@@ -0,0 +1,41 @@
+# bool global
+--source include/have_innodb.inc
+
+SET @start_global_value = @@global.innodb_immediate_scrub_data_uncompressed;
+
+--echo #
+--echo # exists as global only
+--echo #
+select @@global.innodb_immediate_scrub_data_uncompressed;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_immediate_scrub_data_uncompressed;
+show global variables like 'innodb_immediate_scrub_data_uncompressed';
+show session variables like 'innodb_immediate_scrub_data_uncompressed';
+select * from information_schema.global_variables
+where variable_name='innodb_immediate_scrub_data_uncompressed';
+select * from information_schema.session_variables
+where variable_name='innodb_immediate_scrub_data_uncompressed';
+
+--echo #
+--echo # show that it's writable
+--echo #
+set global innodb_immediate_scrub_data_uncompressed=ON;
+select @@global.innodb_immediate_scrub_data_uncompressed;
+set global innodb_immediate_scrub_data_uncompressed=OFF;
+select @@global.innodb_immediate_scrub_data_uncompressed;
+set global innodb_immediate_scrub_data_uncompressed=1;
+select @@global.innodb_immediate_scrub_data_uncompressed;
+--error ER_GLOBAL_VARIABLE
+set session innodb_immediate_scrub_data_uncompressed=1;
+
+--echo #
+--echo # incorrect types
+--echo #
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_immediate_scrub_data_uncompressed=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_immediate_scrub_data_uncompressed=1e1;
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_immediate_scrub_data_uncompressed="foo";
+
+SET @@global.innodb_immediate_scrub_data_uncompressed = @start_global_value;
diff --git a/mysql-test/suite/sys_vars/t/innodb_scrub_force_testing_basic.test b/mysql-test/suite/sys_vars/t/innodb_scrub_force_testing_basic.test
new file mode 100644
index 00000000000..e2df0de4e28
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_scrub_force_testing_basic.test
@@ -0,0 +1,42 @@
+# bool global
+--source include/have_innodb.inc
+--source include/have_debug.inc
+
+SET @start_global_value = @@global.innodb_scrub_force_testing;
+
+--echo #
+--echo # exists as global only
+--echo #
+select @@global.innodb_scrub_force_testing;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_scrub_force_testing;
+show global variables like 'innodb_scrub_force_testing';
+show session variables like 'innodb_scrub_force_testing';
+select * from information_schema.global_variables
+where variable_name='innodb_scrub_force_testing';
+select * from information_schema.session_variables
+where variable_name='innodb_scrub_force_testing';
+
+--echo #
+--echo # show that it's writable
+--echo #
+set global innodb_scrub_force_testing=ON;
+select @@global.innodb_scrub_force_testing;
+set global innodb_scrub_force_testing=OFF;
+select @@global.innodb_scrub_force_testing;
+set global innodb_scrub_force_testing=1;
+select @@global.innodb_scrub_force_testing;
+--error ER_GLOBAL_VARIABLE
+set session innodb_scrub_force_testing=1;
+
+--echo #
+--echo # incorrect types
+--echo #
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_scrub_force_testing=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_scrub_force_testing=1e1;
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_scrub_force_testing="foo";
+
+SET @@global.innodb_scrub_force_testing = @start_global_value;
diff --git a/mysql-test/suite/sys_vars/t/innodb_scrub_log_basic.test b/mysql-test/suite/sys_vars/t/innodb_scrub_log_basic.test
new file mode 100644
index 00000000000..302f2a963c4
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_scrub_log_basic.test
@@ -0,0 +1,50 @@
+--source include/have_innodb.inc
+
+# Display default value
+SELECT @@GLOBAL.innodb_scrub_log;
+--echo 0 Expected
+
+# Check if value can be set
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@GLOBAL.innodb_scrub_log=1;
+--echo Expected error 'Read only variable'
+
+SELECT @@GLOBAL.innodb_scrub_log;
+--echo 0 Expected
+
+# Check if the value in GLOBAL TABLE matches value in variable
+SELECT IF(@@GLOBAL.innodb_scrub_log, 'ON', 'OFF') = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_scrub_log';
+--echo 1 Expected
+
+SELECT @@GLOBAL.innodb_scrub_log;
+--echo 0 Expected
+
+SELECT VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_scrub_log';
+--echo 0 Expected
+
+# Check if accessing variable with and without GLOBAL point to same variable
+SELECT @@innodb_scrub_log = @@GLOBAL.innodb_scrub_log;
+--echo 1 Expected
+
+# Check if innodb_scrub_log can be accessed with and without @@ sign
+SELECT @@innodb_scrub_log;
+--echo 0 Expected
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@local.innodb_scrub_log;
+--echo Expected error 'Variable is a GLOBAL variable'
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@SESSION.innodb_scrub_log;
+--echo Expected error 'Variable is a GLOBAL variable'
+
+SELECT @@GLOBAL.innodb_scrub_log;
+--echo 0 Expected
+
+--Error ER_BAD_FIELD_ERROR
+SELECT innodb_scrub_log;
+--echo Expected error 'Unknow column in field list'
diff --git a/mysql-test/suite/sys_vars/t/innodb_scrub_log_interval_basic.test b/mysql-test/suite/sys_vars/t/innodb_scrub_log_interval_basic.test
new file mode 100644
index 00000000000..e8d4f1bc737
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_scrub_log_interval_basic.test
@@ -0,0 +1,55 @@
+--source include/have_innodb.inc
+
+# Display default value
+SELECT @@GLOBAL.innodb_scrub_log_interval;
+--echo 200 Expected
+
+# Check if value can be set
+SET @@GLOBAL.innodb_scrub_log_interval=100;
+--echo 1 Expected
+
+SELECT @@GLOBAL.innodb_scrub_log_interval;
+--echo 100 Expected
+
+SET @@GLOBAL.innodb_scrub_log_interval=DEFAULT;
+--echo 1 Expected
+
+SELECT @@GLOBAL.innodb_scrub_log_interval;
+--echo 200 Expected
+
+# Check if the value in GLOBAL TABLE matches value in variable
+SELECT @@GLOBAL.innodb_scrub_log_interval = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_scrub_log_interval';
+--echo 1 Expected
+
+SELECT @@GLOBAL.innodb_scrub_log_interval;
+--echo 200 Expected
+
+SELECT VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_scrub_log_interval';
+--echo 200 Expected
+
+# Check if accessing variable with and without GLOBAL point to same variable
+SELECT @@innodb_scrub_log_interval = @@GLOBAL.innodb_scrub_log_interval;
+--echo 1 Expected
+
+# Check if innodb_scrub_log_interval can be accessed with and without @@ sign
+SELECT @@innodb_scrub_log_interval;
+--echo 200 Expected
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@local.innodb_scrub_log_interval;
+--echo Expected error 'Variable is a GLOBAL variable'
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@SESSION.innodb_scrub_log_interval;
+--echo Expected error 'Variable is a GLOBAL variable'
+
+SELECT @@GLOBAL.innodb_scrub_log_interval;
+--echo 200 Expected
+
+--Error ER_BAD_FIELD_ERROR
+SELECT innodb_scrub_log_interval;
+--echo Expected error 'Unknow column in field list'
diff --git a/mysql-test/t/information_schema_all_engines-master.opt b/mysql-test/t/information_schema_all_engines-master.opt
index e37aeaac933..dec3b51813f 100644
--- a/mysql-test/t/information_schema_all_engines-master.opt
+++ b/mysql-test/t/information_schema_all_engines-master.opt
@@ -13,3 +13,5 @@
--loose-innodb-sys-foreign-cols
--loose-innodb-sys-tables
--loose-innodb-sys-tablestats
+--loose-innodb-tablespaces-encryption
+--loose-innodb-tablespaces-scrubbing
diff --git a/mysql-test/t/mysqld--help.test b/mysql-test/t/mysqld--help.test
index 83f58171333..3ffcd31092d 100644
--- a/mysql-test/t/mysqld--help.test
+++ b/mysql-test/t/mysqld--help.test
@@ -30,7 +30,8 @@ perl;
thread-concurrency super-large-pages mutex-deadlock-detector
connect null-audit aria oqgraph sphinx thread-handling
test-sql-discovery rpl-semi-sync query-cache-info
- query-response-time metadata-lock-info locales wsrep/;
+ query-response-time metadata-lock-info locales wsrep
+ file-key-management/;
# And substitute the content some environment variables with their
# names: