mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
move encryption tests to a dedicate suite
remove few tests for variables that never existed (merge error)
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
if (!$EXAMPLE_KEY_MANAGEMENT_SO)
|
||||
{
|
||||
--skip Needs example_key_management
|
||||
}
|
@@ -0,0 +1,2 @@
|
||||
--plugin-load-add=$EXAMPLE_KEY_MANAGEMENT_SO
|
||||
--loose-example-key-management
|
@@ -0,0 +1,11 @@
|
||||
[cbc]
|
||||
plugin-load-add=$FILE_KEY_MANAGEMENT_SO
|
||||
loose-file-key-management
|
||||
loose-file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys.txt
|
||||
file-key-management-encryption-algorithm=aes_cbc
|
||||
|
||||
[ctr]
|
||||
plugin-load-add=$FILE_KEY_MANAGEMENT_SO
|
||||
loose-file-key-management
|
||||
loose-file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys.txt
|
||||
file-key-management-encryption-algorithm=aes_ctr
|
@@ -0,0 +1,4 @@
|
||||
if (!$FILE_KEY_MANAGEMENT_SO)
|
||||
{
|
||||
--skip Needs file_key_management
|
||||
}
|
19
mysql-test/suite/encryption/r/debug_key_management.result
Normal file
19
mysql-test/suite/encryption/r/debug_key_management.result
Normal file
@@ -0,0 +1,19 @@
|
||||
show variables like 'innodb_encrypt%';
|
||||
Variable_name Value
|
||||
innodb_encrypt_log ON
|
||||
innodb_encrypt_tables ON
|
||||
innodb_encryption_rotate_key_age 2
|
||||
innodb_encryption_rotation_iops 100
|
||||
innodb_encryption_threads 4
|
||||
select space,name,current_key_version from information_schema.innodb_tablespaces_encryption order by space;
|
||||
space name current_key_version
|
||||
0 NULL 1
|
||||
1 mysql/innodb_table_stats 1
|
||||
2 mysql/innodb_index_stats 1
|
||||
set global debug_key_management_version=10;
|
||||
select space,name,current_key_version from information_schema.innodb_tablespaces_encryption order by space;
|
||||
space name current_key_version
|
||||
0 NULL 10
|
||||
1 mysql/innodb_table_stats 10
|
||||
2 mysql/innodb_index_stats 10
|
||||
set global debug_key_management_version=1;
|
47
mysql-test/suite/encryption/r/encryption_force.result
Normal file
47
mysql-test/suite/encryption/r/encryption_force.result
Normal file
@@ -0,0 +1,47 @@
|
||||
select @@innodb_encrypt_tables;
|
||||
@@innodb_encrypt_tables
|
||||
FORCE
|
||||
create table t1 (a int) engine=innodb encrypted=yes;
|
||||
create table t2 (a int) engine=innodb encrypted=default;
|
||||
create table t3 (a int) engine=innodb encrypted=no;
|
||||
ERROR HY000: Can't create table `test`.`t3` (errno: 140 "Wrong create options")
|
||||
set global innodb_encrypt_tables='ON';
|
||||
create table t3 (a int) engine=innodb encrypted=no;
|
||||
set global innodb_encrypt_tables='FORCE';
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `encrypted`=yes
|
||||
show create table t2;
|
||||
Table Create Table
|
||||
t2 CREATE TABLE `t2` (
|
||||
`a` int(11) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
show create table t3;
|
||||
Table Create Table
|
||||
t3 CREATE TABLE `t3` (
|
||||
`a` int(11) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `encrypted`=no
|
||||
alter table t1 encrypted=no;
|
||||
ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options")
|
||||
alter table t2 encrypted=yes;
|
||||
alter table t3 encrypted=default;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `encrypted`=yes
|
||||
show create table t2;
|
||||
Table Create Table
|
||||
t2 CREATE TABLE `t2` (
|
||||
`a` int(11) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `encrypted`=yes
|
||||
show create table t3;
|
||||
Table Create Table
|
||||
t3 CREATE TABLE `t3` (
|
||||
`a` int(11) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
drop table t3;
|
38
mysql-test/suite/encryption/r/filekeys_encfile.result
Normal file
38
mysql-test/suite/encryption/r/filekeys_encfile.result
Normal file
@@ -0,0 +1,38 @@
|
||||
create table t1(c1 bigint not null, b char(200)) engine=innodb encrypted=yes encryption_key_id=1;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` bigint(20) NOT NULL,
|
||||
`b` char(200) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `encrypted`=yes `encryption_key_id`=1
|
||||
insert t1 values (12345, repeat('1234567890', 20));
|
||||
alter table t1 encryption_key_id=2;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` bigint(20) NOT NULL,
|
||||
`b` char(200) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `encrypted`=yes `encryption_key_id`=2
|
||||
alter table t1 encryption_key_id=3;
|
||||
ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options")
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` bigint(20) NOT NULL,
|
||||
`b` char(200) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `encrypted`=yes `encryption_key_id`=2
|
||||
alter table t1 encryption_key_id=33;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` bigint(20) NOT NULL,
|
||||
`b` char(200) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `encrypted`=yes `encryption_key_id`=33
|
||||
alter table t1 encryption_key_id=4;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` bigint(20) NOT NULL,
|
||||
`b` char(200) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `encrypted`=yes `encryption_key_id`=4
|
||||
drop table t1;
|
@@ -0,0 +1,9 @@
|
||||
call mtr.add_suppression("Cannot decrypt .*filekeys-data.enc. Wrong key");
|
||||
call mtr.add_suppression("Plugin 'file_key_management' init function returned error");
|
||||
call mtr.add_suppression("Plugin 'file_key_management' registration.*failed");
|
||||
FOUND /Cannot decrypt .*filekeys-data.enc. Wrong key/ in mysqld.1.err
|
||||
create table t1(c1 bigint not null, b char(200)) engine=innodb encrypted=yes encryption_key_id=1;
|
||||
ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
|
||||
select plugin_status from information_schema.plugins
|
||||
where plugin_name = 'file_key_management';
|
||||
plugin_status
|
@@ -0,0 +1,9 @@
|
||||
call mtr.add_suppression("File 'bad' not found");
|
||||
call mtr.add_suppression("Plugin 'file_key_management' init function returned error");
|
||||
call mtr.add_suppression("Plugin 'file_key_management' registration.*failed");
|
||||
FOUND /File 'bad' not found/ in mysqld.1.err
|
||||
create table t1(c1 bigint not null, b char(200)) engine=innodb encrypted=yes encryption_key_id=1;
|
||||
ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
|
||||
select plugin_status from information_schema.plugins
|
||||
where plugin_name = 'file_key_management';
|
||||
plugin_status
|
38
mysql-test/suite/encryption/r/filekeys_encfile_file.result
Normal file
38
mysql-test/suite/encryption/r/filekeys_encfile_file.result
Normal file
@@ -0,0 +1,38 @@
|
||||
create table t1(c1 bigint not null, b char(200)) engine=innodb encrypted=yes encryption_key_id=1;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` bigint(20) NOT NULL,
|
||||
`b` char(200) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `encrypted`=yes `encryption_key_id`=1
|
||||
insert t1 values (12345, repeat('1234567890', 20));
|
||||
alter table t1 encryption_key_id=2;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` bigint(20) NOT NULL,
|
||||
`b` char(200) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `encrypted`=yes `encryption_key_id`=2
|
||||
alter table t1 encryption_key_id=3;
|
||||
ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options")
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` bigint(20) NOT NULL,
|
||||
`b` char(200) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `encrypted`=yes `encryption_key_id`=2
|
||||
alter table t1 encryption_key_id=33;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` bigint(20) NOT NULL,
|
||||
`b` char(200) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `encrypted`=yes `encryption_key_id`=33
|
||||
alter table t1 encryption_key_id=4;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` bigint(20) NOT NULL,
|
||||
`b` char(200) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `encrypted`=yes `encryption_key_id`=4
|
||||
drop table t1;
|
9
mysql-test/suite/encryption/r/filekeys_encfile_no.result
Normal file
9
mysql-test/suite/encryption/r/filekeys_encfile_no.result
Normal file
@@ -0,0 +1,9 @@
|
||||
call mtr.add_suppression("Cannot decrypt .*filekeys-data.enc. Wrong key");
|
||||
call mtr.add_suppression("Plugin 'file_key_management' init function returned error");
|
||||
call mtr.add_suppression("Plugin 'file_key_management' registration.*failed");
|
||||
FOUND /Cannot decrypt .*filekeys-data.enc. Wrong key/ in mysqld.1.err
|
||||
create table t1(c1 bigint not null, b char(200)) engine=innodb encrypted=yes encryption_key_id=1;
|
||||
ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
|
||||
select plugin_status from information_schema.plugins
|
||||
where plugin_name = 'file_key_management';
|
||||
plugin_status
|
9
mysql-test/suite/encryption/r/filekeys_nofile.result
Normal file
9
mysql-test/suite/encryption/r/filekeys_nofile.result
Normal file
@@ -0,0 +1,9 @@
|
||||
call mtr.add_suppression("File '' not found");
|
||||
call mtr.add_suppression("Plugin 'file_key_management' init function returned error");
|
||||
call mtr.add_suppression("Plugin 'file_key_management' registration.*failed");
|
||||
FOUND /File '' not found/ in mysqld.1.err
|
||||
create table t1(c1 bigint not null, b char(200)) engine=innodb encrypted=yes encryption_key_id=1;
|
||||
ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
|
||||
select plugin_status from information_schema.plugins
|
||||
where plugin_name = 'file_key_management';
|
||||
plugin_status
|
129
mysql-test/suite/encryption/r/filekeys_syntax.result
Normal file
129
mysql-test/suite/encryption/r/filekeys_syntax.result
Normal file
@@ -0,0 +1,129 @@
|
||||
call mtr.add_suppression("File '.*keys.txt' not found");
|
||||
call mtr.add_suppression("Plugin 'file_key_management' init function returned error");
|
||||
call mtr.add_suppression("Plugin 'file_key_management' registration.*failed");
|
||||
FOUND /File '.*keys.txt' not found/ in mysqld.1.err
|
||||
create table t1(c1 bigint not null, b char(200)) engine=innodb encrypted=yes encryption_key_id=1;
|
||||
ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
|
||||
select plugin_status from information_schema.plugins
|
||||
where plugin_name = 'file_key_management';
|
||||
plugin_status
|
||||
install soname 'file_key_management';
|
||||
ERROR HY000: Invalid key id at MYSQL_TMP_DIR/keys.txt line 2, column 2
|
||||
call mtr.add_suppression("File '.*keys.txt' not found");
|
||||
call mtr.add_suppression("Plugin 'file_key_management' init function returned error");
|
||||
call mtr.add_suppression("Plugin 'file_key_management' registration.*failed");
|
||||
FOUND /File '.*keys.txt' not found/ in mysqld.1.err
|
||||
create table t1(c1 bigint not null, b char(200)) engine=innodb encrypted=yes encryption_key_id=1;
|
||||
ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
|
||||
select plugin_status from information_schema.plugins
|
||||
where plugin_name = 'file_key_management';
|
||||
plugin_status
|
||||
call mtr.add_suppression("Invalid key id");
|
||||
call mtr.add_suppression("Plugin 'file_key_management' init function returned error");
|
||||
call mtr.add_suppression("Plugin 'file_key_management' registration.*failed");
|
||||
FOUND /Invalid key id/ in mysqld.1.err
|
||||
create table t1(c1 bigint not null, b char(200)) engine=innodb encrypted=yes encryption_key_id=1;
|
||||
ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
|
||||
select plugin_status from information_schema.plugins
|
||||
where plugin_name = 'file_key_management';
|
||||
plugin_status
|
||||
install soname 'file_key_management';
|
||||
ERROR HY000: Invalid key id at MYSQL_TMP_DIR/keys.txt line 2, column 11
|
||||
call mtr.add_suppression("Invalid key id");
|
||||
call mtr.add_suppression("Plugin 'file_key_management' init function returned error");
|
||||
call mtr.add_suppression("Plugin 'file_key_management' registration.*failed");
|
||||
FOUND /Invalid key id/ in mysqld.1.err
|
||||
create table t1(c1 bigint not null, b char(200)) engine=innodb encrypted=yes encryption_key_id=1;
|
||||
ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
|
||||
select plugin_status from information_schema.plugins
|
||||
where plugin_name = 'file_key_management';
|
||||
plugin_status
|
||||
call mtr.add_suppression("Invalid key id");
|
||||
call mtr.add_suppression("Plugin 'file_key_management' init function returned error");
|
||||
call mtr.add_suppression("Plugin 'file_key_management' registration.*failed");
|
||||
FOUND /Invalid key id/ in mysqld.1.err
|
||||
create table t1(c1 bigint not null, b char(200)) engine=innodb encrypted=yes encryption_key_id=1;
|
||||
ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
|
||||
select plugin_status from information_schema.plugins
|
||||
where plugin_name = 'file_key_management';
|
||||
plugin_status
|
||||
install soname 'file_key_management';
|
||||
ERROR HY000: Invalid key at MYSQL_TMP_DIR/keys.txt line 2, column 47
|
||||
call mtr.add_suppression("Invalid key id");
|
||||
call mtr.add_suppression("Plugin 'file_key_management' init function returned error");
|
||||
call mtr.add_suppression("Plugin 'file_key_management' registration.*failed");
|
||||
FOUND /Invalid key id/ in mysqld.1.err
|
||||
create table t1(c1 bigint not null, b char(200)) engine=innodb encrypted=yes encryption_key_id=1;
|
||||
ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
|
||||
select plugin_status from information_schema.plugins
|
||||
where plugin_name = 'file_key_management';
|
||||
plugin_status
|
||||
call mtr.add_suppression("Invalid key");
|
||||
call mtr.add_suppression("Plugin 'file_key_management' init function returned error");
|
||||
call mtr.add_suppression("Plugin 'file_key_management' registration.*failed");
|
||||
FOUND /Invalid key/ in mysqld.1.err
|
||||
create table t1(c1 bigint not null, b char(200)) engine=innodb encrypted=yes encryption_key_id=1;
|
||||
ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
|
||||
select plugin_status from information_schema.plugins
|
||||
where plugin_name = 'file_key_management';
|
||||
plugin_status
|
||||
install soname 'file_key_management';
|
||||
ERROR HY000: Invalid key at MYSQL_TMP_DIR/keys.txt line 2, column 33
|
||||
call mtr.add_suppression("Invalid key");
|
||||
call mtr.add_suppression("Plugin 'file_key_management' init function returned error");
|
||||
call mtr.add_suppression("Plugin 'file_key_management' registration.*failed");
|
||||
FOUND /Invalid key/ in mysqld.1.err
|
||||
create table t1(c1 bigint not null, b char(200)) engine=innodb encrypted=yes encryption_key_id=1;
|
||||
ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
|
||||
select plugin_status from information_schema.plugins
|
||||
where plugin_name = 'file_key_management';
|
||||
plugin_status
|
||||
call mtr.add_suppression("Invalid key");
|
||||
call mtr.add_suppression("Plugin 'file_key_management' init function returned error");
|
||||
call mtr.add_suppression("Plugin 'file_key_management' registration.*failed");
|
||||
FOUND /Invalid key/ in mysqld.1.err
|
||||
create table t1(c1 bigint not null, b char(200)) engine=innodb encrypted=yes encryption_key_id=1;
|
||||
ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
|
||||
select plugin_status from information_schema.plugins
|
||||
where plugin_name = 'file_key_management';
|
||||
plugin_status
|
||||
install soname 'file_key_management';
|
||||
ERROR HY000: Syntax error at MYSQL_TMP_DIR/keys.txt line 2, column 2
|
||||
call mtr.add_suppression("Invalid key");
|
||||
call mtr.add_suppression("Plugin 'file_key_management' init function returned error");
|
||||
call mtr.add_suppression("Plugin 'file_key_management' registration.*failed");
|
||||
FOUND /Invalid key/ in mysqld.1.err
|
||||
create table t1(c1 bigint not null, b char(200)) engine=innodb encrypted=yes encryption_key_id=1;
|
||||
ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
|
||||
select plugin_status from information_schema.plugins
|
||||
where plugin_name = 'file_key_management';
|
||||
plugin_status
|
||||
call mtr.add_suppression("Syntax error");
|
||||
call mtr.add_suppression("Plugin 'file_key_management' init function returned error");
|
||||
call mtr.add_suppression("Plugin 'file_key_management' registration.*failed");
|
||||
FOUND /Syntax error/ in mysqld.1.err
|
||||
create table t1(c1 bigint not null, b char(200)) engine=innodb encrypted=yes encryption_key_id=1;
|
||||
ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
|
||||
select plugin_status from information_schema.plugins
|
||||
where plugin_name = 'file_key_management';
|
||||
plugin_status
|
||||
install soname 'file_key_management';
|
||||
ERROR HY000: Syntax error at MYSQL_TMP_DIR/keys.txt line 2, column 1
|
||||
call mtr.add_suppression("Syntax error");
|
||||
call mtr.add_suppression("Plugin 'file_key_management' init function returned error");
|
||||
call mtr.add_suppression("Plugin 'file_key_management' registration.*failed");
|
||||
FOUND /Syntax error/ in mysqld.1.err
|
||||
create table t1(c1 bigint not null, b char(200)) engine=innodb encrypted=yes encryption_key_id=1;
|
||||
ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
|
||||
select plugin_status from information_schema.plugins
|
||||
where plugin_name = 'file_key_management';
|
||||
plugin_status
|
||||
call mtr.add_suppression("Syntax error");
|
||||
call mtr.add_suppression("Plugin 'file_key_management' init function returned error");
|
||||
call mtr.add_suppression("Plugin 'file_key_management' registration.*failed");
|
||||
FOUND /Syntax error/ in mysqld.1.err
|
||||
create table t1(c1 bigint not null, b char(200)) engine=innodb encrypted=yes encryption_key_id=1;
|
||||
ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
|
||||
select plugin_status from information_schema.plugins
|
||||
where plugin_name = 'file_key_management';
|
||||
plugin_status
|
9
mysql-test/suite/encryption/r/filekeys_unencfile.result
Normal file
9
mysql-test/suite/encryption/r/filekeys_unencfile.result
Normal file
@@ -0,0 +1,9 @@
|
||||
call mtr.add_suppression("Cannot decrypt .*keys.txt. Not encrypted");
|
||||
call mtr.add_suppression("Plugin 'file_key_management' init function returned error");
|
||||
call mtr.add_suppression("Plugin 'file_key_management' registration.*failed");
|
||||
FOUND /Cannot decrypt .*keys.txt. Not encrypted/ in mysqld.1.err
|
||||
create table t1(c1 bigint not null, b char(200)) engine=innodb encrypted=yes encryption_key_id=1;
|
||||
ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
|
||||
select plugin_status from information_schema.plugins
|
||||
where plugin_name = 'file_key_management';
|
||||
plugin_status
|
125
mysql-test/suite/encryption/r/innodb-page_encryption-32k.result
Normal file
125
mysql-test/suite/encryption/r/innodb-page_encryption-32k.result
Normal file
@@ -0,0 +1,125 @@
|
||||
call mtr.add_suppression("InnoDB: Warning: innodb_page_size has been changed from default value *");
|
||||
SET GLOBAL innodb_file_format = `Barracuda`;
|
||||
SET GLOBAL innodb_file_per_table = ON;
|
||||
create table innodb_normal(c1 bigint not null, b char(200)) engine=innodb;
|
||||
create table innodb_compact(c1 bigint not null, b char(200)) engine=innodb row_format=compact encrypted=yes encryption_key_id=1;
|
||||
create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic encrypted=yes encryption_key_id=3;
|
||||
create table innodb_redundant(c1 bigint not null, b char(200)) engine=innodb row_format=redundant encrypted=yes encryption_key_id=4;
|
||||
show create table innodb_compact;
|
||||
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 `encrypted`=yes `encryption_key_id`=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 `encrypted`=yes `encryption_key_id`=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 `encrypted`=yes `encryption_key_id`=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()), -150));
|
||||
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;
|
||||
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;
|
||||
count(*)
|
||||
5000
|
||||
select count(*) from innodb_dynamic where c1 < 1500000;
|
||||
count(*)
|
||||
5000
|
||||
select count(*) from innodb_redundant where c1 < 1500000;
|
||||
count(*)
|
||||
5000
|
||||
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;
|
||||
count(*)
|
||||
5000
|
||||
select count(*) from innodb_dynamic where c1 < 1500000;
|
||||
count(*)
|
||||
5000
|
||||
select count(*) from innodb_redundant where c1 < 1500000;
|
||||
count(*)
|
||||
5000
|
||||
alter table innodb_compact engine=innodb encrypted=DEFAULT encryption_key_id=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 encrypted=DEFAULT encryption_key_id=DEFAULT;
|
||||
Warnings:
|
||||
Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_format > Antelope.
|
||||
Warning 1478 InnoDB: assuming 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
|
||||
alter table innodb_redundant engine=innodb encrypted=DEFAULT encryption_key_id=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
|
||||
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
|
||||
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_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_dynamic where c1 < 1500000;
|
||||
count(*)
|
||||
5000
|
||||
select count(*) from innodb_redundant where c1 < 1500000;
|
||||
count(*)
|
||||
5000
|
||||
drop procedure innodb_insert_proc;
|
||||
drop table innodb_normal;
|
||||
drop table innodb_compact;
|
||||
drop table innodb_dynamic;
|
||||
drop table innodb_redundant;
|
262
mysql-test/suite/encryption/r/innodb-page_encryption.result
Normal file
262
mysql-test/suite/encryption/r/innodb-page_encryption.result
Normal file
@@ -0,0 +1,262 @@
|
||||
SET GLOBAL innodb_file_format = `Barracuda`;
|
||||
SET GLOBAL innodb_file_per_table = ON;
|
||||
create table innodb_normal(c1 bigint not null, b char(200)) engine=innodb;
|
||||
create table innodb_compact(c1 bigint not null, b char(200)) engine=innodb row_format=compact encrypted=yes encryption_key_id=1;
|
||||
create table innodb_compressed(c1 bigint not null, b char(200)) engine=innodb row_format=compressed encrypted=yes encryption_key_id=2;
|
||||
create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic encrypted=yes encryption_key_id=3;
|
||||
ERROR HY000: Can't create table `test`.`innodb_dynamic` (errno: 140 "Wrong create options")
|
||||
create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic encrypted=yes encryption_key_id=33;
|
||||
create table innodb_redundant(c1 bigint not null, b char(200)) engine=innodb row_format=redundant encrypted=yes encryption_key_id=4;
|
||||
set innodb_default_encryption_key_id = 5;
|
||||
create table innodb_defkey(c1 bigint not null, b char(200)) engine=innodb encrypted=yes;
|
||||
show create table innodb_defkey;
|
||||
Table Create Table
|
||||
innodb_defkey CREATE TABLE `innodb_defkey` (
|
||||
`c1` bigint(20) NOT NULL,
|
||||
`b` char(200) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `encrypted`=yes `ENCRYPTION_KEY_ID`=5
|
||||
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 `encrypted`=yes `encryption_key_id`=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 `encrypted`=yes `encryption_key_id`=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 `encrypted`=yes `encryption_key_id`=33
|
||||
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 `encrypted`=yes `encryption_key_id`=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(2000);
|
||||
commit;
|
||||
set autocommit=1;
|
||||
insert into innodb_compact select * from innodb_normal;
|
||||
insert into innodb_compressed select * from innodb_normal;
|
||||
insert into innodb_dynamic select * from innodb_normal;
|
||||
insert into innodb_redundant select * from innodb_normal;
|
||||
insert into innodb_defkey select * from innodb_normal;
|
||||
update innodb_normal set c1 = c1 +1;
|
||||
update innodb_compact set c1 = c1 + 1;
|
||||
update innodb_compressed set c1 = c1 + 1;
|
||||
update innodb_dynamic set c1 = c1 + 1;
|
||||
update innodb_redundant set c1 = c1 + 1;
|
||||
update innodb_defkey set c1 = c1 + 1;
|
||||
select count(*) from innodb_compact where c1 < 1500000;
|
||||
count(*)
|
||||
2000
|
||||
select count(*) from innodb_compressed where c1 < 1500000;
|
||||
count(*)
|
||||
2000
|
||||
select count(*) from innodb_dynamic where c1 < 1500000;
|
||||
count(*)
|
||||
2000
|
||||
select count(*) from innodb_redundant where c1 < 1500000;
|
||||
count(*)
|
||||
2000
|
||||
select count(*) from innodb_defkey where c1 < 1500000;
|
||||
count(*)
|
||||
2000
|
||||
select count(*) from innodb_compact t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
count(*)
|
||||
2000
|
||||
select count(*) from innodb_dynamic t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
count(*)
|
||||
2000
|
||||
select count(*) from innodb_compressed t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
count(*)
|
||||
2000
|
||||
select count(*) from innodb_redundant t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
count(*)
|
||||
2000
|
||||
select count(*) from innodb_defkey t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
count(*)
|
||||
2000
|
||||
SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_encrypted';
|
||||
variable_value >= 0
|
||||
1
|
||||
SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_decrypted';
|
||||
variable_value >= 0
|
||||
1
|
||||
SET GLOBAL innodb_file_format = `Barracuda`;
|
||||
SET GLOBAL innodb_file_per_table = ON;
|
||||
update innodb_normal set c1 = c1 +1;
|
||||
update innodb_compact set c1 = c1 + 1;
|
||||
update innodb_compressed set c1 = c1 + 1;
|
||||
update innodb_dynamic set c1 = c1 + 1;
|
||||
update innodb_redundant set c1 = c1 + 1;
|
||||
update innodb_defkey set c1 = c1 + 1;
|
||||
select count(*) from innodb_compact where c1 < 1500000;
|
||||
count(*)
|
||||
2000
|
||||
select count(*) from innodb_compressed where c1 < 1500000;
|
||||
count(*)
|
||||
2000
|
||||
select count(*) from innodb_dynamic where c1 < 1500000;
|
||||
count(*)
|
||||
2000
|
||||
select count(*) from innodb_redundant where c1 < 1500000;
|
||||
count(*)
|
||||
2000
|
||||
select count(*) from innodb_defkey where c1 < 1500000;
|
||||
count(*)
|
||||
2000
|
||||
select count(*) from innodb_compact t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
count(*)
|
||||
2000
|
||||
select count(*) from innodb_dynamic t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
count(*)
|
||||
2000
|
||||
select count(*) from innodb_compressed t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
count(*)
|
||||
2000
|
||||
select count(*) from innodb_redundant t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
count(*)
|
||||
2000
|
||||
select count(*) from innodb_defkey t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
count(*)
|
||||
2000
|
||||
SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_encrypted';
|
||||
variable_value >= 0
|
||||
1
|
||||
SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_decrypted';
|
||||
variable_value >= 0
|
||||
1
|
||||
alter table innodb_compact engine=innodb encrypted=DEFAULT encryption_key_id=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 encrypted=DEFAULT encryption_key_id=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 encrypted=DEFAULT encryption_key_id=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 encrypted=DEFAULT encryption_key_id=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
|
||||
show create table innodb_defkey;
|
||||
Table Create Table
|
||||
innodb_defkey CREATE TABLE `innodb_defkey` (
|
||||
`c1` bigint(20) NOT NULL,
|
||||
`b` char(200) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `encrypted`=yes `ENCRYPTION_KEY_ID`=5
|
||||
update innodb_normal set c1 = c1 +1;
|
||||
update innodb_compact set c1 = c1 + 1;
|
||||
update innodb_compressed set c1 = c1 + 1;
|
||||
update innodb_dynamic set c1 = c1 + 1;
|
||||
update innodb_redundant set c1 = c1 + 1;
|
||||
select count(*) from innodb_compact where c1 < 1500000;
|
||||
count(*)
|
||||
2000
|
||||
select count(*) from innodb_compressed where c1 < 1500000;
|
||||
count(*)
|
||||
2000
|
||||
select count(*) from innodb_dynamic where c1 < 1500000;
|
||||
count(*)
|
||||
2000
|
||||
select count(*) from innodb_redundant where c1 < 1500000;
|
||||
count(*)
|
||||
2000
|
||||
select count(*) from innodb_compact t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
count(*)
|
||||
2000
|
||||
select count(*) from innodb_dynamic t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
count(*)
|
||||
2000
|
||||
select count(*) from innodb_compressed t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
count(*)
|
||||
2000
|
||||
select count(*) from innodb_redundant t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
count(*)
|
||||
2000
|
||||
SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_encrypted';
|
||||
variable_value = 0
|
||||
1
|
||||
SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_decrypted';
|
||||
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;
|
||||
drop table innodb_defkey;
|
@@ -0,0 +1,180 @@
|
||||
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 encrypted=yes encryption_key_id=1 page_compressed=1;
|
||||
create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic encrypted=yes encryption_key_id=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 `encrypted`=yes `encryption_key_id`=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 `encrypted`=yes `encryption_key_id`=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()), -128));
|
||||
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 count(*) from innodb_compact t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
count(*)
|
||||
5000
|
||||
select count(*) from innodb_dynamic t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
count(*)
|
||||
5000
|
||||
SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_encrypted';
|
||||
variable_value >= 0
|
||||
1
|
||||
SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_decrypted';
|
||||
variable_value >= 0
|
||||
1
|
||||
SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_compressed';
|
||||
variable_value >= 0
|
||||
SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_decompressed';
|
||||
variable_value >= 0
|
||||
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 count(*) from innodb_compact t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
count(*)
|
||||
5000
|
||||
select count(*) from innodb_dynamic t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
count(*)
|
||||
5000
|
||||
SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_encrypted';
|
||||
variable_value >= 0
|
||||
1
|
||||
SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_decrypted';
|
||||
variable_value >= 0
|
||||
1
|
||||
SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_compressed';
|
||||
variable_value >= 0
|
||||
SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_decompressed';
|
||||
variable_value >= 0
|
||||
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 encrypted=DEFAULT encryption_key_id=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 encrypted=DEFAULT encryption_key_id=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 count(*) from innodb_compact t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
count(*)
|
||||
5000
|
||||
select count(*) from innodb_dynamic t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
count(*)
|
||||
5000
|
||||
SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_encrypted';
|
||||
variable_value = 0
|
||||
1
|
||||
SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_decrypted';
|
||||
variable_value = 0
|
||||
1
|
||||
SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_compressed';
|
||||
variable_value = 0
|
||||
SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_decompressed';
|
||||
variable_value = 0
|
||||
drop procedure innodb_insert_proc;
|
||||
drop table innodb_normal;
|
||||
drop table innodb_compact;
|
||||
drop table innodb_dynamic;
|
@@ -0,0 +1,231 @@
|
||||
call mtr.add_suppression("KeyID 0 not found or with error. Check the key and the log*");
|
||||
call mtr.add_suppression("Disabling redo log encryp*");
|
||||
call mtr.add_suppression("InnoDB: Redo log crypto: Can't initialize to key version*");
|
||||
SET GLOBAL innodb_file_format = `Barracuda`;
|
||||
SET GLOBAL innodb_file_per_table = ON;
|
||||
create table innodb_normal(c1 bigint not null, b char(200)) engine=innodb;
|
||||
create table innodb_compact(c1 bigint not null, b char(200)) engine=innodb row_format=compact encrypted=yes encryption_key_id=1;
|
||||
create table innodb_compressed(c1 bigint not null, b char(200)) engine=innodb row_format=compressed encrypted=yes encryption_key_id=2;
|
||||
create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic encrypted=yes encryption_key_id=33;
|
||||
create table innodb_redundant(c1 bigint not null, b char(200)) engine=innodb row_format=redundant encrypted=yes encryption_key_id=4;
|
||||
show create table innodb_compact;
|
||||
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 `encrypted`=yes `encryption_key_id`=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 `encrypted`=yes `encryption_key_id`=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 `encrypted`=yes `encryption_key_id`=33
|
||||
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 `encrypted`=yes `encryption_key_id`=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(2000);
|
||||
commit;
|
||||
set autocommit=1;
|
||||
insert into innodb_compact select * from innodb_normal;
|
||||
insert into innodb_compressed select * from innodb_normal;
|
||||
insert into innodb_dynamic select * from innodb_normal;
|
||||
insert into innodb_redundant select * from innodb_normal;
|
||||
update innodb_normal set c1 = c1 +1;
|
||||
update innodb_compact set c1 = c1 + 1;
|
||||
update innodb_compressed set c1 = c1 + 1;
|
||||
update innodb_dynamic set c1 = c1 + 1;
|
||||
update innodb_redundant set c1 = c1 + 1;
|
||||
select count(*) from innodb_compact where c1 < 1500000;
|
||||
count(*)
|
||||
2000
|
||||
select count(*) from innodb_compressed where c1 < 1500000;
|
||||
count(*)
|
||||
2000
|
||||
select count(*) from innodb_dynamic where c1 < 1500000;
|
||||
count(*)
|
||||
2000
|
||||
select count(*) from innodb_redundant where c1 < 1500000;
|
||||
count(*)
|
||||
2000
|
||||
select count(*) from innodb_compact t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
count(*)
|
||||
2000
|
||||
select count(*) from innodb_dynamic t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
count(*)
|
||||
2000
|
||||
select count(*) from innodb_compressed t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
count(*)
|
||||
2000
|
||||
select count(*) from innodb_redundant t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
count(*)
|
||||
2000
|
||||
SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_encrypted';
|
||||
variable_value >= 0
|
||||
1
|
||||
SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_decrypted';
|
||||
variable_value >= 0
|
||||
1
|
||||
SET GLOBAL innodb_file_format = `Barracuda`;
|
||||
SET GLOBAL innodb_file_per_table = ON;
|
||||
update innodb_normal set c1 = c1 +1;
|
||||
update innodb_compact set c1 = c1 + 1;
|
||||
update innodb_compressed set c1 = c1 + 1;
|
||||
update innodb_dynamic set c1 = c1 + 1;
|
||||
update innodb_redundant set c1 = c1 + 1;
|
||||
select count(*) from innodb_compact where c1 < 1500000;
|
||||
count(*)
|
||||
2000
|
||||
select count(*) from innodb_compressed where c1 < 1500000;
|
||||
count(*)
|
||||
2000
|
||||
select count(*) from innodb_dynamic where c1 < 1500000;
|
||||
count(*)
|
||||
2000
|
||||
select count(*) from innodb_redundant where c1 < 1500000;
|
||||
count(*)
|
||||
2000
|
||||
select count(*) from innodb_compact t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
count(*)
|
||||
2000
|
||||
select count(*) from innodb_dynamic t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
count(*)
|
||||
2000
|
||||
select count(*) from innodb_compressed t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
count(*)
|
||||
2000
|
||||
select count(*) from innodb_redundant t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
count(*)
|
||||
2000
|
||||
SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_encrypted';
|
||||
variable_value >= 0
|
||||
1
|
||||
SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_decrypted';
|
||||
variable_value >= 0
|
||||
1
|
||||
alter table innodb_compact engine=innodb encrypted=DEFAULT encryption_key_id=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 encrypted=DEFAULT encryption_key_id=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 encrypted=DEFAULT encryption_key_id=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 encrypted=DEFAULT encryption_key_id=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_normal set c1 = c1 +1;
|
||||
update innodb_compact set c1 = c1 + 1;
|
||||
update innodb_compressed set c1 = c1 + 1;
|
||||
update innodb_dynamic set c1 = c1 + 1;
|
||||
update innodb_redundant set c1 = c1 + 1;
|
||||
select count(*) from innodb_compact where c1 < 1500000;
|
||||
count(*)
|
||||
2000
|
||||
select count(*) from innodb_compressed where c1 < 1500000;
|
||||
count(*)
|
||||
2000
|
||||
select count(*) from innodb_dynamic where c1 < 1500000;
|
||||
count(*)
|
||||
2000
|
||||
select count(*) from innodb_redundant where c1 < 1500000;
|
||||
count(*)
|
||||
2000
|
||||
select count(*) from innodb_compact t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
count(*)
|
||||
2000
|
||||
select count(*) from innodb_dynamic t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
count(*)
|
||||
2000
|
||||
select count(*) from innodb_compressed t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
count(*)
|
||||
2000
|
||||
select count(*) from innodb_redundant t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
count(*)
|
||||
2000
|
||||
SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_encrypted';
|
||||
variable_value = 0
|
||||
1
|
||||
SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_decrypted';
|
||||
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;
|
@@ -0,0 +1,3 @@
|
||||
SET GLOBAL innodb_file_format = `Barracuda`;
|
||||
SET GLOBAL innodb_file_per_table = ON;
|
||||
set global innodb_compression_algorithm = 1;
|
57
mysql-test/suite/encryption/r/innodb_encryption.result
Normal file
57
mysql-test/suite/encryption/r/innodb_encryption.result
Normal file
@@ -0,0 +1,57 @@
|
||||
SET @start_global_value = @@global.innodb_encryption_threads;
|
||||
SHOW VARIABLES LIKE 'innodb_encrypt%';
|
||||
Variable_name Value
|
||||
innodb_encrypt_log ON
|
||||
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 ON
|
||||
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
|
161
mysql-test/suite/encryption/r/innodb_encryption_tables.result
Normal file
161
mysql-test/suite/encryption/r/innodb_encryption_tables.result
Normal file
@@ -0,0 +1,161 @@
|
||||
SET GLOBAL innodb_file_format = `Barracuda`;
|
||||
SET GLOBAL innodb_file_per_table = ON;
|
||||
create table innodb_normal(c1 bigint not null, b char(200)) engine=innodb;
|
||||
create table innodb_compact(c1 bigint not null, b char(200)) engine=innodb row_format=compact;
|
||||
create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic;
|
||||
create table innodb_compressed(c1 bigint not null, b char(200)) engine=innodb row_format=compressed;
|
||||
create table innodb_redundant(c1 bigint not null, b char(200)) engine=innodb row_format=redundant;
|
||||
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
|
||||
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
|
||||
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_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
|
||||
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(2000);
|
||||
commit;
|
||||
set autocommit=1;
|
||||
insert into innodb_compact select * from innodb_normal;
|
||||
insert into innodb_dynamic select * from innodb_normal;
|
||||
insert into innodb_compressed select * from innodb_normal;
|
||||
insert into innodb_redundant 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;
|
||||
update innodb_compressed set c1 = c1 + 1;
|
||||
update innodb_redundant set c1 = c1 + 1;
|
||||
select count(*) from innodb_normal;
|
||||
count(*)
|
||||
2000
|
||||
select count(*) from innodb_compact where c1 < 1500000;
|
||||
count(*)
|
||||
2000
|
||||
select count(*) from innodb_dynamic where c1 < 1500000;
|
||||
count(*)
|
||||
2000
|
||||
select count(*) from innodb_compressed where c1 < 1500000;
|
||||
count(*)
|
||||
2000
|
||||
select count(*) from innodb_redundant where c1 < 1500000;
|
||||
count(*)
|
||||
2000
|
||||
select count(*) from innodb_compact t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
count(*)
|
||||
2000
|
||||
select count(*) from innodb_dynamic t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
count(*)
|
||||
2000
|
||||
select count(*) from innodb_compressed t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
count(*)
|
||||
2000
|
||||
select count(*) from innodb_redundant t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
count(*)
|
||||
2000
|
||||
SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_encrypted';
|
||||
variable_value >= 0
|
||||
1
|
||||
SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_decrypted';
|
||||
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;
|
||||
update innodb_normal set c1 = c1 + 1;
|
||||
update innodb_compact set c1 = c1 + 1;
|
||||
update innodb_dynamic set c1 = c1 + 1;
|
||||
update innodb_compressed set c1 = c1 + 1;
|
||||
update innodb_redundant set c1 = c1 + 1;
|
||||
select count(*) from innodb_normal;
|
||||
count(*)
|
||||
2000
|
||||
select count(*) from innodb_compact where c1 < 1500000;
|
||||
count(*)
|
||||
2000
|
||||
select count(*) from innodb_dynamic where c1 < 1500000;
|
||||
count(*)
|
||||
2000
|
||||
select count(*) from innodb_compressed where c1 < 1500000;
|
||||
count(*)
|
||||
2000
|
||||
select count(*) from innodb_redundant where c1 < 1500000;
|
||||
count(*)
|
||||
2000
|
||||
select count(*) from innodb_compact t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
count(*)
|
||||
2000
|
||||
select count(*) from innodb_dynamic t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
count(*)
|
||||
2000
|
||||
select count(*) from innodb_compressed t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
count(*)
|
||||
2000
|
||||
select count(*) from innodb_redundant t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
count(*)
|
||||
2000
|
||||
SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_encrypted';
|
||||
variable_value >= 0
|
||||
1
|
||||
SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_decrypted';
|
||||
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;
|
||||
drop table innodb_compressed;
|
||||
drop table innodb_redundant;
|
5
mysql-test/suite/encryption/r/innodb_first_page.result
Normal file
5
mysql-test/suite/encryption/r/innodb_first_page.result
Normal file
@@ -0,0 +1,5 @@
|
||||
call mtr.add_suppression("InnoDB: New log files created, LSN");
|
||||
call mtr.add_suppression("InnoDB: Creating foreign key constraint system tables");
|
||||
shutdown;
|
||||
create table t1 (a int);
|
||||
drop table t1;
|
224
mysql-test/suite/encryption/r/innodb_scrub.result
Normal file
224
mysql-test/suite/encryption/r/innodb_scrub.result
Normal file
@@ -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;
|
88
mysql-test/suite/encryption/r/innodb_scrub_background.result
Normal file
88
mysql-test/suite/encryption/r/innodb_scrub_background.result
Normal file
@@ -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;
|
71
mysql-test/suite/encryption/r/innodb_scrub_compressed.result
Normal file
71
mysql-test/suite/encryption/r/innodb_scrub_compressed.result
Normal file
@@ -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;
|
16
mysql-test/suite/encryption/suite.pm
Normal file
16
mysql-test/suite/encryption/suite.pm
Normal file
@@ -0,0 +1,16 @@
|
||||
package My::Suite::Encryption;
|
||||
|
||||
@ISA = qw(My::Suite);
|
||||
|
||||
sub skip_combinations {
|
||||
my @combinations;
|
||||
|
||||
$skip{'include/have_file_key_management_plugin.combinations'} = [ 'ctr' ]
|
||||
unless $::mysqld_variables{'version-ssl-library'} =~ /OpenSSL (\S+)/
|
||||
and $1 ge "1.0.1";
|
||||
|
||||
%skip;
|
||||
}
|
||||
|
||||
bless { };
|
||||
|
6
mysql-test/suite/encryption/t/debug_key_management.opt
Normal file
6
mysql-test/suite/encryption/t/debug_key_management.opt
Normal file
@@ -0,0 +1,6 @@
|
||||
--innodb-encrypt-tables=ON
|
||||
--innodb-encrypt-log=ON
|
||||
--innodb-encryption-rotate-key-age=2
|
||||
--innodb-encryption-threads=4
|
||||
--innodb-tablespaces-encryption
|
||||
--plugin-load-add=$DEBUG_KEY_MANAGEMENT_SO
|
21
mysql-test/suite/encryption/t/debug_key_management.test
Normal file
21
mysql-test/suite/encryption/t/debug_key_management.test
Normal file
@@ -0,0 +1,21 @@
|
||||
-- source include/have_innodb.inc
|
||||
if (`select count(*) = 0 from information_schema.plugins
|
||||
where plugin_name = 'debug_key_management' and plugin_status='active'`)
|
||||
{
|
||||
--skip Needs debug_key_management
|
||||
}
|
||||
|
||||
show variables like 'innodb_encrypt%';
|
||||
|
||||
let $wait_condition= select count(*) = 3 from information_schema.innodb_tablespaces_encryption where current_key_version=1;
|
||||
--source include/wait_condition.inc
|
||||
|
||||
select space,name,current_key_version from information_schema.innodb_tablespaces_encryption order by space;
|
||||
set global debug_key_management_version=10;
|
||||
|
||||
let $wait_condition= select count(*) = 3 from information_schema.innodb_tablespaces_encryption where current_key_version=10;
|
||||
--source include/wait_condition.inc
|
||||
|
||||
select space,name,current_key_version from information_schema.innodb_tablespaces_encryption order by space;
|
||||
set global debug_key_management_version=1;
|
||||
|
2
mysql-test/suite/encryption/t/encryption_force.opt
Normal file
2
mysql-test/suite/encryption/t/encryption_force.opt
Normal file
@@ -0,0 +1,2 @@
|
||||
--innodb-encrypt-tables=FORCE
|
||||
--innodb-encrypt-log=ON
|
31
mysql-test/suite/encryption/t/encryption_force.test
Normal file
31
mysql-test/suite/encryption/t/encryption_force.test
Normal file
@@ -0,0 +1,31 @@
|
||||
-- source include/have_innodb.inc
|
||||
-- source include/have_example_key_management_plugin.inc
|
||||
|
||||
select @@innodb_encrypt_tables;
|
||||
|
||||
create table t1 (a int) engine=innodb encrypted=yes;
|
||||
create table t2 (a int) engine=innodb encrypted=default;
|
||||
--error ER_CANT_CREATE_TABLE
|
||||
create table t3 (a int) engine=innodb encrypted=no;
|
||||
|
||||
set global innodb_encrypt_tables='ON';
|
||||
create table t3 (a int) engine=innodb encrypted=no;
|
||||
set global innodb_encrypt_tables='FORCE';
|
||||
|
||||
show create table t1;
|
||||
show create table t2;
|
||||
show create table t3;
|
||||
|
||||
--replace_regex /#sql-[0-9a-f_]*/#sql-temporary/
|
||||
--error ER_CANT_CREATE_TABLE
|
||||
alter table t1 encrypted=no;
|
||||
alter table t2 encrypted=yes;
|
||||
alter table t3 encrypted=default;
|
||||
|
||||
show create table t1;
|
||||
show create table t2;
|
||||
show create table t3;
|
||||
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
drop table t3;
|
BIN
mysql-test/suite/encryption/t/filekeys-data.enc
Normal file
BIN
mysql-test/suite/encryption/t/filekeys-data.enc
Normal file
Binary file not shown.
1
mysql-test/suite/encryption/t/filekeys-data.key
Normal file
1
mysql-test/suite/encryption/t/filekeys-data.key
Normal file
@@ -0,0 +1 @@
|
||||
secret
|
18
mysql-test/suite/encryption/t/filekeys_badtest.inc
Normal file
18
mysql-test/suite/encryption/t/filekeys_badtest.inc
Normal file
@@ -0,0 +1,18 @@
|
||||
-- source include/not_embedded.inc
|
||||
-- source include/have_xtradb.inc
|
||||
-- source filekeys_plugin.inc
|
||||
|
||||
--eval call mtr.add_suppression("$SEARCH_PATTERN")
|
||||
call mtr.add_suppression("Plugin 'file_key_management' init function returned error");
|
||||
call mtr.add_suppression("Plugin 'file_key_management' registration.*failed");
|
||||
|
||||
--let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err
|
||||
--let SEARCH_RANGE= -10000
|
||||
--source include/search_pattern_in_file.inc
|
||||
|
||||
--error ER_CANT_CREATE_TABLE
|
||||
create table t1(c1 bigint not null, b char(200)) engine=innodb encrypted=yes encryption_key_id=1;
|
||||
|
||||
select plugin_status from information_schema.plugins
|
||||
where plugin_name = 'file_key_management';
|
||||
|
2
mysql-test/suite/encryption/t/filekeys_encfile.opt
Normal file
2
mysql-test/suite/encryption/t/filekeys_encfile.opt
Normal file
@@ -0,0 +1,2 @@
|
||||
--loose-file-key-management-filekey=secret
|
||||
--loose-file-key-management-filename=$MTR_SUITE_DIR/t/filekeys-data.enc
|
1
mysql-test/suite/encryption/t/filekeys_encfile.test
Normal file
1
mysql-test/suite/encryption/t/filekeys_encfile.test
Normal file
@@ -0,0 +1 @@
|
||||
source filekeys_goodtest.inc;
|
2
mysql-test/suite/encryption/t/filekeys_encfile_bad.opt
Normal file
2
mysql-test/suite/encryption/t/filekeys_encfile_bad.opt
Normal file
@@ -0,0 +1,2 @@
|
||||
--loose-file-key-management-filekey=bad
|
||||
--loose-file-key-management-filename=$MTR_SUITE_DIR/t/filekeys-data.enc
|
2
mysql-test/suite/encryption/t/filekeys_encfile_bad.test
Normal file
2
mysql-test/suite/encryption/t/filekeys_encfile_bad.test
Normal file
@@ -0,0 +1,2 @@
|
||||
let SEARCH_PATTERN=Cannot decrypt .*filekeys-data.enc. Wrong key;
|
||||
source filekeys_badtest.inc;
|
@@ -0,0 +1,2 @@
|
||||
--loose-file-key-management-filekey=FILE:bad
|
||||
--loose-file-key-management-filename=$MTR_SUITE_DIR/t/filekeys-data.enc
|
@@ -0,0 +1,2 @@
|
||||
let SEARCH_PATTERN=File 'bad' not found;
|
||||
source filekeys_badtest.inc;
|
2
mysql-test/suite/encryption/t/filekeys_encfile_file.opt
Normal file
2
mysql-test/suite/encryption/t/filekeys_encfile_file.opt
Normal file
@@ -0,0 +1,2 @@
|
||||
--loose-file-key-management-filekey=FILE:$MTR_SUITE_DIR/t/filekeys-data.key
|
||||
--loose-file-key-management-filename=$MTR_SUITE_DIR/t/filekeys-data.enc
|
1
mysql-test/suite/encryption/t/filekeys_encfile_file.test
Normal file
1
mysql-test/suite/encryption/t/filekeys_encfile_file.test
Normal file
@@ -0,0 +1 @@
|
||||
source filekeys_goodtest.inc;
|
1
mysql-test/suite/encryption/t/filekeys_encfile_no.opt
Normal file
1
mysql-test/suite/encryption/t/filekeys_encfile_no.opt
Normal file
@@ -0,0 +1 @@
|
||||
--loose-file-key-management-filename=$MTR_SUITE_DIR/t/filekeys-data.enc
|
2
mysql-test/suite/encryption/t/filekeys_encfile_no.test
Normal file
2
mysql-test/suite/encryption/t/filekeys_encfile_no.test
Normal file
@@ -0,0 +1,2 @@
|
||||
let SEARCH_PATTERN=Cannot decrypt .*filekeys-data.enc. Wrong key;
|
||||
source filekeys_badtest.inc;
|
20
mysql-test/suite/encryption/t/filekeys_goodtest.inc
Normal file
20
mysql-test/suite/encryption/t/filekeys_goodtest.inc
Normal file
@@ -0,0 +1,20 @@
|
||||
-- source include/have_xtradb.inc
|
||||
-- source filekeys_plugin.inc
|
||||
|
||||
create table t1(c1 bigint not null, b char(200)) engine=innodb encrypted=yes encryption_key_id=1;
|
||||
show create table t1;
|
||||
insert t1 values (12345, repeat('1234567890', 20));
|
||||
|
||||
alter table t1 encryption_key_id=2;
|
||||
show create table t1;
|
||||
--replace_regex /#sql-[0-9a-f_]*/#sql-temporary/
|
||||
--error ER_CANT_CREATE_TABLE
|
||||
alter table t1 encryption_key_id=3;
|
||||
show create table t1;
|
||||
alter table t1 encryption_key_id=33;
|
||||
show create table t1;
|
||||
alter table t1 encryption_key_id=4;
|
||||
show create table t1;
|
||||
|
||||
drop table t1;
|
||||
|
2
mysql-test/suite/encryption/t/filekeys_nofile.test
Normal file
2
mysql-test/suite/encryption/t/filekeys_nofile.test
Normal file
@@ -0,0 +1,2 @@
|
||||
let SEARCH_PATTERN=File '' not found;
|
||||
source filekeys_badtest.inc;
|
4
mysql-test/suite/encryption/t/filekeys_plugin.inc
Normal file
4
mysql-test/suite/encryption/t/filekeys_plugin.inc
Normal file
@@ -0,0 +1,4 @@
|
||||
if (!$FILE_KEY_MANAGEMENT_SO)
|
||||
{
|
||||
--skip Needs file_key_management
|
||||
}
|
1
mysql-test/suite/encryption/t/filekeys_plugin.opt
Normal file
1
mysql-test/suite/encryption/t/filekeys_plugin.opt
Normal file
@@ -0,0 +1 @@
|
||||
--plugin-load-add=$FILE_KEY_MANAGEMENT_SO
|
1
mysql-test/suite/encryption/t/filekeys_syntax.opt
Normal file
1
mysql-test/suite/encryption/t/filekeys_syntax.opt
Normal file
@@ -0,0 +1 @@
|
||||
--loose-file-key-management-filename=$MYSQL_TMP_DIR/keys.txt
|
96
mysql-test/suite/encryption/t/filekeys_syntax.test
Normal file
96
mysql-test/suite/encryption/t/filekeys_syntax.test
Normal file
@@ -0,0 +1,96 @@
|
||||
#
|
||||
# first test - missing key file
|
||||
#
|
||||
let SEARCH_PATTERN=File '.*keys.txt' not found;
|
||||
source filekeys_badtest.inc;
|
||||
|
||||
#
|
||||
# key id= 0
|
||||
#
|
||||
write_file $MYSQL_TMP_DIR/keys.txt;
|
||||
1;11111111111111111111111111111111
|
||||
0;00000000000000000000000000000000
|
||||
2;22222222222222222222222222222222
|
||||
EOF
|
||||
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
|
||||
--error 2
|
||||
install soname 'file_key_management';
|
||||
source filekeys_badtest.inc;
|
||||
let SEARCH_PATTERN=Invalid key id;
|
||||
source filekeys_badtest.inc;
|
||||
|
||||
#
|
||||
# id too big
|
||||
#
|
||||
remove_file $MYSQL_TMP_DIR/keys.txt;
|
||||
write_file $MYSQL_TMP_DIR/keys.txt;
|
||||
1;11111111111111111111111111111111
|
||||
4294967299;00000000000000000000000000000000
|
||||
2;22222222222222222222222222222222
|
||||
EOF
|
||||
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
|
||||
--error 2
|
||||
install soname 'file_key_management';
|
||||
source filekeys_badtest.inc;
|
||||
let SEARCH_PATTERN=Invalid key id;
|
||||
source filekeys_badtest.inc;
|
||||
#
|
||||
# wrong key length (not 16, 24, 23 bytes)
|
||||
#
|
||||
remove_file $MYSQL_TMP_DIR/keys.txt;
|
||||
write_file $MYSQL_TMP_DIR/keys.txt;
|
||||
1;11111111111111111111111111111111
|
||||
3;00000000000000000000000000000000111122223333
|
||||
2;22222222222222222222222222222222
|
||||
EOF
|
||||
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
|
||||
--error 2
|
||||
install soname 'file_key_management';
|
||||
source filekeys_badtest.inc;
|
||||
let SEARCH_PATTERN=Invalid key;
|
||||
source filekeys_badtest.inc;
|
||||
#
|
||||
# wrong key length (not an even number of digits)
|
||||
#
|
||||
remove_file $MYSQL_TMP_DIR/keys.txt;
|
||||
write_file $MYSQL_TMP_DIR/keys.txt;
|
||||
1;11111111111111111111111111111111
|
||||
3;0000000000000000000000000000000
|
||||
2;22222222222222222222222222222222
|
||||
EOF
|
||||
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
|
||||
--error 2
|
||||
install soname 'file_key_management';
|
||||
source filekeys_badtest.inc;
|
||||
let SEARCH_PATTERN=Invalid key;
|
||||
source filekeys_badtest.inc;
|
||||
#
|
||||
# no semicolon
|
||||
#
|
||||
remove_file $MYSQL_TMP_DIR/keys.txt;
|
||||
write_file $MYSQL_TMP_DIR/keys.txt;
|
||||
1;11111111111111111111111111111111
|
||||
3:0000000000000000000000000000000
|
||||
2;22222222222222222222222222222222
|
||||
EOF
|
||||
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
|
||||
--error 2
|
||||
install soname 'file_key_management';
|
||||
source filekeys_badtest.inc;
|
||||
let SEARCH_PATTERN=Syntax error;
|
||||
source filekeys_badtest.inc;
|
||||
#
|
||||
# another syntax error
|
||||
#
|
||||
remove_file $MYSQL_TMP_DIR/keys.txt;
|
||||
write_file $MYSQL_TMP_DIR/keys.txt;
|
||||
1;11111111111111111111111111111111
|
||||
syntax error
|
||||
2;22222222222222222222222222222222
|
||||
EOF
|
||||
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
|
||||
--error 2
|
||||
install soname 'file_key_management';
|
||||
source filekeys_badtest.inc;
|
||||
let SEARCH_PATTERN=Syntax error;
|
||||
source filekeys_badtest.inc;
|
2
mysql-test/suite/encryption/t/filekeys_unencfile.opt
Normal file
2
mysql-test/suite/encryption/t/filekeys_unencfile.opt
Normal file
@@ -0,0 +1,2 @@
|
||||
--loose-file-key-management-filekey=bad
|
||||
--loose-file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys.txt
|
2
mysql-test/suite/encryption/t/filekeys_unencfile.test
Normal file
2
mysql-test/suite/encryption/t/filekeys_unencfile.test
Normal file
@@ -0,0 +1,2 @@
|
||||
let SEARCH_PATTERN=Cannot decrypt .*keys.txt. Not encrypted;
|
||||
source filekeys_badtest.inc;
|
@@ -0,0 +1,2 @@
|
||||
--default_storage_engine=InnoDB
|
||||
--innodb-buffer-pool-size=24M
|
@@ -0,0 +1,96 @@
|
||||
--source include/no_valgrind_without_big.inc
|
||||
--source include/not_embedded.inc
|
||||
# Tests for setting innodb-page-size=32k;
|
||||
--source include/have_innodb.inc
|
||||
--source include/have_innodb_32k.inc
|
||||
--source include/have_file_key_management_plugin.inc
|
||||
|
||||
call mtr.add_suppression("InnoDB: Warning: innodb_page_size has been changed from default value *");
|
||||
|
||||
--disable_query_log
|
||||
# These values can change during the test
|
||||
let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
|
||||
let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
|
||||
--enable_query_log
|
||||
|
||||
SET GLOBAL innodb_file_format = `Barracuda`;
|
||||
SET GLOBAL innodb_file_per_table = ON;
|
||||
|
||||
create table innodb_normal(c1 bigint not null, b char(200)) engine=innodb;
|
||||
create table innodb_compact(c1 bigint not null, b char(200)) engine=innodb row_format=compact encrypted=yes encryption_key_id=1;
|
||||
create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic encrypted=yes encryption_key_id=3;
|
||||
create table innodb_redundant(c1 bigint not null, b char(200)) engine=innodb row_format=redundant encrypted=yes encryption_key_id=4;
|
||||
|
||||
show create table innodb_compact;
|
||||
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 encrypted=DEFAULT encryption_key_id=DEFAULT;
|
||||
show create table innodb_compact;
|
||||
alter table innodb_dynamic engine=innodb encrypted=DEFAULT encryption_key_id=DEFAULT;
|
||||
show create table innodb_dynamic;
|
||||
alter table innodb_redundant engine=innodb encrypted=DEFAULT encryption_key_id=DEFAULT;
|
||||
show create table innodb_redundant;
|
||||
|
||||
--source include/restart_mysqld.inc
|
||||
|
||||
show create table innodb_compact;
|
||||
show create table innodb_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
|
164
mysql-test/suite/encryption/t/innodb-page_encryption.test
Normal file
164
mysql-test/suite/encryption/t/innodb-page_encryption.test
Normal file
@@ -0,0 +1,164 @@
|
||||
-- source include/have_innodb.inc
|
||||
-- source include/have_file_key_management_plugin.inc
|
||||
|
||||
--disable_query_log
|
||||
let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
|
||||
let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
|
||||
--enable_query_log
|
||||
|
||||
SET GLOBAL innodb_file_format = `Barracuda`;
|
||||
SET GLOBAL innodb_file_per_table = ON;
|
||||
|
||||
create table innodb_normal(c1 bigint not null, b char(200)) engine=innodb;
|
||||
create table innodb_compact(c1 bigint not null, b char(200)) engine=innodb row_format=compact encrypted=yes encryption_key_id=1;
|
||||
create table innodb_compressed(c1 bigint not null, b char(200)) engine=innodb row_format=compressed encrypted=yes encryption_key_id=2;
|
||||
--error ER_CANT_CREATE_TABLE
|
||||
create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic encrypted=yes encryption_key_id=3;
|
||||
create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic encrypted=yes encryption_key_id=33;
|
||||
create table innodb_redundant(c1 bigint not null, b char(200)) engine=innodb row_format=redundant encrypted=yes encryption_key_id=4;
|
||||
|
||||
set innodb_default_encryption_key_id = 5;
|
||||
create table innodb_defkey(c1 bigint not null, b char(200)) engine=innodb encrypted=yes;
|
||||
show create table innodb_defkey;
|
||||
|
||||
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(2000);
|
||||
commit;
|
||||
set autocommit=1;
|
||||
|
||||
insert into innodb_compact select * from innodb_normal;
|
||||
insert into innodb_compressed select * from innodb_normal;
|
||||
insert into innodb_dynamic select * from innodb_normal;
|
||||
insert into innodb_redundant select * from innodb_normal;
|
||||
insert into innodb_defkey select * from innodb_normal;
|
||||
|
||||
update innodb_normal set c1 = c1 +1;
|
||||
update innodb_compact set c1 = c1 + 1;
|
||||
update innodb_compressed set c1 = c1 + 1;
|
||||
update innodb_dynamic set c1 = c1 + 1;
|
||||
update innodb_redundant set c1 = c1 + 1;
|
||||
update innodb_defkey set c1 = c1 + 1;
|
||||
|
||||
select count(*) from innodb_compact where c1 < 1500000;
|
||||
select count(*) from innodb_compressed where c1 < 1500000;
|
||||
select count(*) from innodb_dynamic where c1 < 1500000;
|
||||
select count(*) from innodb_redundant where c1 < 1500000;
|
||||
select count(*) from innodb_defkey where c1 < 1500000;
|
||||
select count(*) from innodb_compact t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
select count(*) from innodb_dynamic t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
select count(*) from innodb_compressed t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
select count(*) from innodb_redundant t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
select count(*) from innodb_defkey t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
|
||||
# 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_encrypted';
|
||||
SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_decrypted';
|
||||
|
||||
--source include/restart_mysqld.inc
|
||||
|
||||
SET GLOBAL innodb_file_format = `Barracuda`;
|
||||
SET GLOBAL innodb_file_per_table = ON;
|
||||
|
||||
update innodb_normal set c1 = c1 +1;
|
||||
update innodb_compact set c1 = c1 + 1;
|
||||
update innodb_compressed set c1 = c1 + 1;
|
||||
update innodb_dynamic set c1 = c1 + 1;
|
||||
update innodb_redundant set c1 = c1 + 1;
|
||||
update innodb_defkey set c1 = c1 + 1;
|
||||
select count(*) from innodb_compact where c1 < 1500000;
|
||||
select count(*) from innodb_compressed where c1 < 1500000;
|
||||
select count(*) from innodb_dynamic where c1 < 1500000;
|
||||
select count(*) from innodb_redundant where c1 < 1500000;
|
||||
select count(*) from innodb_defkey where c1 < 1500000;
|
||||
select count(*) from innodb_compact t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
select count(*) from innodb_dynamic t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
select count(*) from innodb_compressed t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
select count(*) from innodb_redundant t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
select count(*) from innodb_defkey t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
|
||||
SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_encrypted';
|
||||
SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_decrypted';
|
||||
|
||||
alter table innodb_compact engine=innodb encrypted=DEFAULT encryption_key_id=DEFAULT;
|
||||
show create table innodb_compact;
|
||||
alter table innodb_compressed engine=innodb encrypted=DEFAULT encryption_key_id=DEFAULT;
|
||||
show create table innodb_compressed;
|
||||
alter table innodb_dynamic engine=innodb encrypted=DEFAULT encryption_key_id=DEFAULT;
|
||||
show create table innodb_dynamic;
|
||||
alter table innodb_redundant engine=innodb encrypted=DEFAULT encryption_key_id=DEFAULT;
|
||||
show create table innodb_redundant;
|
||||
|
||||
--source include/restart_mysqld.inc
|
||||
|
||||
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;
|
||||
show create table innodb_defkey;
|
||||
|
||||
update innodb_normal set c1 = c1 +1;
|
||||
update innodb_compact set c1 = c1 + 1;
|
||||
update innodb_compressed set c1 = c1 + 1;
|
||||
update innodb_dynamic set c1 = c1 + 1;
|
||||
update innodb_redundant set c1 = c1 + 1;
|
||||
select count(*) from innodb_compact where c1 < 1500000;
|
||||
select count(*) from innodb_compressed where c1 < 1500000;
|
||||
select count(*) from innodb_dynamic where c1 < 1500000;
|
||||
select count(*) from innodb_redundant where c1 < 1500000;
|
||||
select count(*) from innodb_compact t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
select count(*) from innodb_dynamic t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
select count(*) from innodb_compressed t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
select count(*) from innodb_redundant t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
|
||||
# After alter+restart these should be 0
|
||||
SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_encrypted';
|
||||
SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_decrypted';
|
||||
|
||||
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;
|
||||
drop table innodb_defkey;
|
||||
|
||||
# reset system
|
||||
--disable_query_log
|
||||
EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig;
|
||||
EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig;
|
||||
--enable_query_log
|
@@ -0,0 +1,127 @@
|
||||
-- source include/have_innodb.inc
|
||||
-- source include/not_embedded.inc
|
||||
-- source include/have_file_key_management_plugin.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 encrypted=yes encryption_key_id=1 page_compressed=1;
|
||||
create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic encrypted=yes encryption_key_id=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()), -128));
|
||||
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 count(*) from innodb_compact t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
select count(*) from innodb_dynamic t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
|
||||
SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_encrypted';
|
||||
SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_decrypted';
|
||||
SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_compressed';
|
||||
SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_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 count(*) from innodb_compact t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
select count(*) from innodb_dynamic t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
|
||||
SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_encrypted';
|
||||
SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_decrypted';
|
||||
SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_compressed';
|
||||
SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_decompressed';
|
||||
|
||||
alter table innodb_normal engine=innodb page_compressed=DEFAULT;
|
||||
show create table innodb_normal;
|
||||
alter table innodb_compact engine=innodb encrypted=DEFAULT encryption_key_id=DEFAULT page_compressed=DEFAULT;
|
||||
show create table innodb_compact;
|
||||
alter table innodb_dynamic engine=innodb encrypted=DEFAULT encryption_key_id=DEFAULT page_compressed=DEFAULT;
|
||||
show create table innodb_dynamic;
|
||||
|
||||
--source include/restart_mysqld.inc
|
||||
|
||||
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 count(*) from innodb_compact t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
select count(*) from innodb_dynamic t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
|
||||
SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_encrypted';
|
||||
SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_decrypted';
|
||||
SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_compressed';
|
||||
SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_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
|
@@ -0,0 +1 @@
|
||||
--innodb-encrypt-log
|
@@ -0,0 +1,151 @@
|
||||
-- source include/have_innodb.inc
|
||||
-- source include/not_embedded.inc
|
||||
-- source include/have_file_key_management_plugin.inc
|
||||
|
||||
--disable_query_log
|
||||
let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
|
||||
let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
|
||||
--enable_query_log
|
||||
|
||||
call mtr.add_suppression("KeyID 0 not found or with error. Check the key and the log*");
|
||||
call mtr.add_suppression("Disabling redo log encryp*");
|
||||
call mtr.add_suppression("InnoDB: Redo log crypto: Can't initialize to key version*");
|
||||
|
||||
SET GLOBAL innodb_file_format = `Barracuda`;
|
||||
SET GLOBAL innodb_file_per_table = ON;
|
||||
|
||||
create table innodb_normal(c1 bigint not null, b char(200)) engine=innodb;
|
||||
create table innodb_compact(c1 bigint not null, b char(200)) engine=innodb row_format=compact encrypted=yes encryption_key_id=1;
|
||||
create table innodb_compressed(c1 bigint not null, b char(200)) engine=innodb row_format=compressed encrypted=yes encryption_key_id=2;
|
||||
create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic encrypted=yes encryption_key_id=33;
|
||||
create table innodb_redundant(c1 bigint not null, b char(200)) engine=innodb row_format=redundant encrypted=yes encryption_key_id=4;
|
||||
|
||||
show create table innodb_compact;
|
||||
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(2000);
|
||||
commit;
|
||||
set autocommit=1;
|
||||
|
||||
insert into innodb_compact select * from innodb_normal;
|
||||
insert into innodb_compressed select * from innodb_normal;
|
||||
insert into innodb_dynamic select * from innodb_normal;
|
||||
insert into innodb_redundant select * from innodb_normal;
|
||||
|
||||
update innodb_normal set c1 = c1 +1;
|
||||
update innodb_compact set c1 = c1 + 1;
|
||||
update innodb_compressed set c1 = c1 + 1;
|
||||
update innodb_dynamic set c1 = c1 + 1;
|
||||
update innodb_redundant set c1 = c1 + 1;
|
||||
select count(*) from innodb_compact where c1 < 1500000;
|
||||
select count(*) from innodb_compressed where c1 < 1500000;
|
||||
select count(*) from innodb_dynamic where c1 < 1500000;
|
||||
select count(*) from innodb_redundant where c1 < 1500000;
|
||||
select count(*) from innodb_compact t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
select count(*) from innodb_dynamic t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
select count(*) from innodb_compressed t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
select count(*) from innodb_redundant t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
|
||||
# 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_encrypted';
|
||||
SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_decrypted';
|
||||
|
||||
--source include/restart_mysqld.inc
|
||||
|
||||
SET GLOBAL innodb_file_format = `Barracuda`;
|
||||
SET GLOBAL innodb_file_per_table = ON;
|
||||
|
||||
update innodb_normal set c1 = c1 +1;
|
||||
update innodb_compact set c1 = c1 + 1;
|
||||
update innodb_compressed set c1 = c1 + 1;
|
||||
update innodb_dynamic set c1 = c1 + 1;
|
||||
update innodb_redundant set c1 = c1 + 1;
|
||||
select count(*) from innodb_compact where c1 < 1500000;
|
||||
select count(*) from innodb_compressed where c1 < 1500000;
|
||||
select count(*) from innodb_dynamic where c1 < 1500000;
|
||||
select count(*) from innodb_redundant where c1 < 1500000;
|
||||
select count(*) from innodb_compact t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
select count(*) from innodb_dynamic t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
select count(*) from innodb_compressed t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
select count(*) from innodb_redundant t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
|
||||
SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_encrypted';
|
||||
SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_decrypted';
|
||||
|
||||
alter table innodb_compact engine=innodb encrypted=DEFAULT encryption_key_id=DEFAULT;
|
||||
show create table innodb_compact;
|
||||
alter table innodb_compressed engine=innodb encrypted=DEFAULT encryption_key_id=DEFAULT;
|
||||
show create table innodb_compressed;
|
||||
alter table innodb_dynamic engine=innodb encrypted=DEFAULT encryption_key_id=DEFAULT;
|
||||
show create table innodb_dynamic;
|
||||
alter table innodb_redundant engine=innodb encrypted=DEFAULT encryption_key_id=DEFAULT;
|
||||
show create table innodb_redundant;
|
||||
|
||||
--source include/restart_mysqld.inc
|
||||
|
||||
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_normal set c1 = c1 +1;
|
||||
update innodb_compact set c1 = c1 + 1;
|
||||
update innodb_compressed set c1 = c1 + 1;
|
||||
update innodb_dynamic set c1 = c1 + 1;
|
||||
update innodb_redundant set c1 = c1 + 1;
|
||||
select count(*) from innodb_compact where c1 < 1500000;
|
||||
select count(*) from innodb_compressed where c1 < 1500000;
|
||||
select count(*) from innodb_dynamic where c1 < 1500000;
|
||||
select count(*) from innodb_redundant where c1 < 1500000;
|
||||
select count(*) from innodb_compact t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
select count(*) from innodb_dynamic t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
select count(*) from innodb_compressed t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
select count(*) from innodb_redundant t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
|
||||
# After alter+restart these should be 0
|
||||
SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_encrypted';
|
||||
SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_decrypted';
|
||||
|
||||
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
|
@@ -0,0 +1,7 @@
|
||||
--aria-encrypt-tables=ON
|
||||
--encrypt-tmp-disk-tables=ON
|
||||
--innodb-encrypt-tables=ON
|
||||
--innodb-encrypt-log=ON
|
||||
--innodb-encryption-rotate-key-age=15
|
||||
--innodb-encryption-threads=4
|
||||
--innodb-tablespaces-encryption
|
@@ -0,0 +1,23 @@
|
||||
-- source include/have_innodb.inc
|
||||
-- source include/have_example_key_management_plugin.inc
|
||||
|
||||
# embedded does not support restart
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
--disable_query_log
|
||||
let $innodb_compression_algorithm_orig=`SELECT @@innodb_compression_algorithm`;
|
||||
let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
|
||||
let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
|
||||
--enable_query_log
|
||||
|
||||
SET GLOBAL innodb_file_format = `Barracuda`;
|
||||
SET GLOBAL innodb_file_per_table = ON;
|
||||
# zlib
|
||||
set global innodb_compression_algorithm = 1;
|
||||
|
||||
# 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
|
8
mysql-test/suite/encryption/t/innodb_encryption.opt
Normal file
8
mysql-test/suite/encryption/t/innodb_encryption.opt
Normal file
@@ -0,0 +1,8 @@
|
||||
--aria-encrypt-tables=ON
|
||||
--encrypt-tmp-disk-tables=ON
|
||||
--innodb-encrypt-tables=ON
|
||||
--innodb-encrypt-log=ON
|
||||
--innodb-encryption-rotate-key-age=15
|
||||
--innodb-encryption-threads=4
|
||||
--innodb-tablespaces-encryption
|
||||
|
176
mysql-test/suite/encryption/t/innodb_encryption.test
Normal file
176
mysql-test/suite/encryption/t/innodb_encryption.test
Normal file
@@ -0,0 +1,176 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
-- source include/have_innodb.inc
|
||||
-- source include/have_example_key_management_plugin.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
|
@@ -0,0 +1,7 @@
|
||||
--aria-encrypt-tables=ON
|
||||
--encrypt-tmp-disk-tables=ON
|
||||
--innodb-encrypt-tables=ON
|
||||
--innodb-encrypt-log=ON
|
||||
--innodb-encryption-rotate-key-age=15
|
||||
--innodb-encryption-threads=4
|
||||
--innodb-tablespaces-encryption
|
114
mysql-test/suite/encryption/t/innodb_encryption_tables.test
Normal file
114
mysql-test/suite/encryption/t/innodb_encryption_tables.test
Normal file
@@ -0,0 +1,114 @@
|
||||
-- source include/have_innodb.inc
|
||||
-- source include/have_example_key_management_plugin.inc
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
--disable_query_log
|
||||
let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
|
||||
let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
|
||||
--enable_query_log
|
||||
|
||||
SET GLOBAL innodb_file_format = `Barracuda`;
|
||||
SET GLOBAL innodb_file_per_table = ON;
|
||||
|
||||
create table innodb_normal(c1 bigint not null, b char(200)) engine=innodb;
|
||||
create table innodb_compact(c1 bigint not null, b char(200)) engine=innodb row_format=compact;
|
||||
create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic;
|
||||
create table innodb_compressed(c1 bigint not null, b char(200)) engine=innodb row_format=compressed;
|
||||
create table innodb_redundant(c1 bigint not null, b char(200)) engine=innodb row_format=redundant;
|
||||
|
||||
show warnings;
|
||||
|
||||
show create table innodb_normal;
|
||||
show create table innodb_compact;
|
||||
show create table innodb_dynamic;
|
||||
show create table innodb_compressed;
|
||||
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(2000);
|
||||
commit;
|
||||
set autocommit=1;
|
||||
|
||||
insert into innodb_compact select * from innodb_normal;
|
||||
insert into innodb_dynamic select * from innodb_normal;
|
||||
insert into innodb_compressed select * from innodb_normal;
|
||||
insert into innodb_redundant 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;
|
||||
update innodb_compressed set c1 = c1 + 1;
|
||||
update innodb_redundant set c1 = c1 + 1;
|
||||
select count(*) from innodb_normal;
|
||||
select count(*) from innodb_compact where c1 < 1500000;
|
||||
select count(*) from innodb_dynamic where c1 < 1500000;
|
||||
select count(*) from innodb_compressed where c1 < 1500000;
|
||||
select count(*) from innodb_redundant where c1 < 1500000;
|
||||
select count(*) from innodb_compact t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
select count(*) from innodb_dynamic t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
select count(*) from innodb_compressed t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
select count(*) from innodb_redundant t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
|
||||
SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_encrypted';
|
||||
SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_decrypted';
|
||||
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;
|
||||
|
||||
update innodb_normal set c1 = c1 + 1;
|
||||
update innodb_compact set c1 = c1 + 1;
|
||||
update innodb_dynamic set c1 = c1 + 1;
|
||||
update innodb_compressed set c1 = c1 + 1;
|
||||
update innodb_redundant set c1 = c1 + 1;
|
||||
select count(*) from innodb_normal;
|
||||
select count(*) from innodb_compact where c1 < 1500000;
|
||||
select count(*) from innodb_dynamic where c1 < 1500000;
|
||||
select count(*) from innodb_compressed where c1 < 1500000;
|
||||
select count(*) from innodb_redundant where c1 < 1500000;
|
||||
select count(*) from innodb_compact t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
select count(*) from innodb_dynamic t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
select count(*) from innodb_compressed t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
select count(*) from innodb_redundant t1, innodb_normal t2 where
|
||||
t1.c1 = t2.c1 and t1.b = t2.b;
|
||||
|
||||
SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_encrypted';
|
||||
SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_decrypted';
|
||||
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;
|
||||
drop table innodb_compressed;
|
||||
drop table innodb_redundant;
|
||||
|
||||
# reset system
|
||||
--disable_query_log
|
||||
EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig;
|
||||
EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig;
|
||||
--enable_query_log
|
2
mysql-test/suite/encryption/t/innodb_first_page.opt
Normal file
2
mysql-test/suite/encryption/t/innodb_first_page.opt
Normal file
@@ -0,0 +1,2 @@
|
||||
--innodb-encrypt-tables
|
||||
--innodb-encrypt-log
|
30
mysql-test/suite/encryption/t/innodb_first_page.test
Normal file
30
mysql-test/suite/encryption/t/innodb_first_page.test
Normal file
@@ -0,0 +1,30 @@
|
||||
#
|
||||
# MDEV-8021 "InnoDB: Tablespace id 4 encrypted but encryption service not available. Can't continue opening tablespace" on server restart when there are encrypted tables
|
||||
#
|
||||
|
||||
--source include/have_innodb.inc
|
||||
--source include/have_file_key_management_plugin.inc
|
||||
|
||||
call mtr.add_suppression("InnoDB: New log files created, LSN");
|
||||
call mtr.add_suppression("InnoDB: Creating foreign key constraint system tables");
|
||||
|
||||
let datadir=`select @@datadir`;
|
||||
|
||||
--exec echo wait > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
|
||||
|
||||
shutdown;
|
||||
|
||||
--remove_file $datadir/ib_logfile0
|
||||
--remove_file $datadir/ib_logfile1
|
||||
--remove_file $datadir/ibdata1
|
||||
|
||||
--exec echo restart > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
|
||||
|
||||
--enable_reconnect
|
||||
--source include/wait_until_connected_again.inc
|
||||
|
||||
create table t1 (a int);
|
||||
|
||||
--source include/restart_mysqld.inc
|
||||
|
||||
drop table t1;
|
12
mysql-test/suite/encryption/t/innodb_scrub.opt
Normal file
12
mysql-test/suite/encryption/t/innodb_scrub.opt
Normal file
@@ -0,0 +1,12 @@
|
||||
--aria-encrypt-tables=ON
|
||||
--encrypt-tmp-disk-tables=ON
|
||||
--innodb-background-scrub-data-compressed=OFF
|
||||
--innodb-background-scrub-data-uncompressed=OFF
|
||||
--innodb-encrypt-tables=ON
|
||||
--innodb-encrypt-log=ON
|
||||
--innodb-encryption-rotate-key-age=15
|
||||
--innodb-encryption-threads=4
|
||||
--innodb-file-format=Barracuda
|
||||
--innodb-file-per-table=1
|
||||
--innodb-immediate-scrub-data-uncompressed=ON
|
||||
--loose-innodb-debug-force-scrubbing=ON
|
156
mysql-test/suite/encryption/t/innodb_scrub.test
Normal file
156
mysql-test/suite/encryption/t/innodb_scrub.test
Normal file
@@ -0,0 +1,156 @@
|
||||
-- source include/have_innodb.inc
|
||||
-- source include/not_embedded.inc
|
||||
-- source include/have_example_key_management_plugin.inc
|
||||
-- source include/not_windows.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;
|
13
mysql-test/suite/encryption/t/innodb_scrub_background.opt
Normal file
13
mysql-test/suite/encryption/t/innodb_scrub_background.opt
Normal file
@@ -0,0 +1,13 @@
|
||||
--innodb-file-per-table=1
|
||||
--innodb-file-format=Barracuda
|
||||
--innodb-immediate-scrub-data-uncompressed=OFF
|
||||
--innodb-background-scrub-data-uncompressed=ON
|
||||
--innodb-background-scrub-data-compressed=ON
|
||||
--loose-innodb-debug-force-scrubbing=ON
|
||||
--encrypt-tmp-disk-tables=ON
|
||||
--aria-encrypt-tables=ON
|
||||
--innodb-encryption-threads=4
|
||||
--innodb-encryption-rotate-key-age=15
|
||||
--innodb-encrypt-tables=ON
|
||||
--innodb-encrypt-log=ON
|
||||
--innodb-tablespaces-scrubbing
|
170
mysql-test/suite/encryption/t/innodb_scrub_background.test
Normal file
170
mysql-test/suite/encryption/t/innodb_scrub_background.test
Normal file
@@ -0,0 +1,170 @@
|
||||
-- source include/have_innodb.inc
|
||||
-- source include/not_embedded.inc
|
||||
-- source include/have_example_key_management_plugin.inc
|
||||
-- source include/not_windows.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;
|
13
mysql-test/suite/encryption/t/innodb_scrub_compressed.opt
Normal file
13
mysql-test/suite/encryption/t/innodb_scrub_compressed.opt
Normal file
@@ -0,0 +1,13 @@
|
||||
--innodb-file-per-table=1
|
||||
--innodb-file-format=Barracuda
|
||||
--innodb-immediate-scrub-data-uncompressed=ON
|
||||
--innodb-background-scrub-data-uncompressed=ON
|
||||
--innodb-background-scrub-data-compressed=ON
|
||||
--loose-innodb-debug-force-scrubbing=ON
|
||||
--encrypt-tmp-disk-tables=ON
|
||||
--aria-encrypt-tables=ON
|
||||
--innodb-encryption-threads=4
|
||||
--innodb-encryption-rotate-key-age=15
|
||||
--innodb-encrypt-tables=ON
|
||||
--innodb-encrypt-log=ON
|
||||
--innodb-tablespaces-scrubbing
|
161
mysql-test/suite/encryption/t/innodb_scrub_compressed.test
Normal file
161
mysql-test/suite/encryption/t/innodb_scrub_compressed.test
Normal file
@@ -0,0 +1,161 @@
|
||||
-- source include/have_innodb.inc
|
||||
-- source include/not_embedded.inc
|
||||
-- source include/have_example_key_management_plugin.inc
|
||||
-- source include/not_windows.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;
|
Reference in New Issue
Block a user