1
0
mirror of https://github.com/MariaDB/server.git synced 2025-11-18 07:48:43 +03:00

InnoDB/XtraDB Encryption cleanup

Step 5:
-- Rename encryption_key -> encryption_key_id
-- Remove unnecessary code
-- Fix few bugs found
-- Fix test cases and results files
This commit is contained in:
Jan Lindström
2015-04-02 13:49:50 +03:00
committed by Sergei Golubchik
parent af768c2f22
commit 4865fd105a
37 changed files with 466 additions and 437 deletions

View 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 encryption='ON' encryption_key_id=1;
create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic encryption='ON' encryption_key_id=3;
create table innodb_redundant(c1 bigint not null, b char(200)) engine=innodb row_format=redundant encryption='ON' 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 `encryption`='ON' `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 `encryption`='ON' `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 `encryption`='ON' `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 encryption=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 encryption=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 encryption=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;

View File

@@ -1,42 +1,42 @@
SET GLOBAL innodb_file_format = `Barracuda`;
SET GLOBAL innodb_file_per_table = ON;
create table innodb_normal(c1 bigint not null, b char(200)) engine=innodb;
create table innodb_compact(c1 bigint not null, b char(200)) engine=innodb row_format=compact page_encryption=1 page_encryption_key=1;
create table innodb_compressed(c1 bigint not null, b char(200)) engine=innodb row_format=compressed page_encryption=1 page_encryption_key=2;
create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic page_encryption=1 page_encryption_key=3;
create table innodb_redundant(c1 bigint not null, b char(200)) engine=innodb row_format=redundant page_encryption=1 page_encryption_key=4;
SET GLOBAL innodb_default_page_encryption_key = 5;
create table innodb_defkey(c1 bigint not null, b char(200)) engine=innodb page_encryption=1;
create table innodb_compact(c1 bigint not null, b char(200)) engine=innodb row_format=compact encryption='ON' encryption_key_id=1;
create table innodb_compressed(c1 bigint not null, b char(200)) engine=innodb row_format=compressed encryption='ON' encryption_key_id=2;
create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic encryption='ON' encryption_key_id=3;
create table innodb_redundant(c1 bigint not null, b char(200)) engine=innodb row_format=redundant encryption='ON' encryption_key_id=4;
SET GLOBAL innodb_default_encryption_key = 5;
create table innodb_defkey(c1 bigint not null, b char(200)) engine=innodb encryption='ON';
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 `page_encryption`=1
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `encryption`='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 `page_encryption`=1 `page_encryption_key`=1
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT `encryption`='ON' `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 `page_encryption`=1 `page_encryption_key`=2
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED `encryption`='ON' `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 `page_encryption`=1 `page_encryption_key`=3
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC `encryption`='ON' `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 `page_encryption`=1 `page_encryption_key`=4
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT `encryption`='ON' `encryption_key_id`=4
create procedure innodb_insert_proc (repeat_count int)
begin
declare current_num int;
@@ -97,15 +97,12 @@ 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_page_encrypted';
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_page_decrypted';
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_encryption_error';
variable_value = 0
1
SET GLOBAL innodb_file_format = `Barracuda`;
SET GLOBAL innodb_file_per_table = ON;
update innodb_normal set c1 = c1 +1;
@@ -149,37 +146,34 @@ 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_page_encrypted';
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_page_decrypted';
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_encryption_error';
variable_value = 0
1
alter table innodb_compact engine=innodb page_encryption=DEFAULT page_encryption_key=DEFAULT;
alter table innodb_compact engine=innodb encryption=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 page_encryption=DEFAULT page_encryption_key=DEFAULT;
alter table innodb_compressed engine=innodb encryption=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 page_encryption=DEFAULT page_encryption_key=DEFAULT;
alter table innodb_dynamic engine=innodb encryption=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 page_encryption=DEFAULT page_encryption_key=DEFAULT;
alter table innodb_redundant engine=innodb encryption=DEFAULT encryption_key_id=DEFAULT;
show create table innodb_redundant;
Table Create Table
innodb_redundant CREATE TABLE `innodb_redundant` (
@@ -217,7 +211,7 @@ Table Create Table
innodb_defkey CREATE TABLE `innodb_defkey` (
`c1` bigint(20) NOT NULL,
`b` char(200) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_encryption`=1
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `encryption`='ON'
update innodb_normal set c1 = c1 +1;
update innodb_compact set c1 = c1 + 1;
update innodb_compressed set c1 = c1 + 1;
@@ -251,13 +245,10 @@ 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_page_encrypted';
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_page_decrypted';
variable_value = 0
1
SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_encryption_error';
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;

View File

@@ -2,8 +2,8 @@ SET GLOBAL innodb_file_format = `Barracuda`;
SET GLOBAL innodb_file_per_table = ON;
set global innodb_compression_algorithm = 1;
create table innodb_normal(c1 bigint not null, b char(200)) engine=innodb page_compressed=1;
create table innodb_compact(c1 bigint not null, b char(200)) engine=innodb row_format=compact page_encryption=1 page_encryption_key=1 page_compressed=1;
create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic page_encryption=1 page_encryption_key=2 page_compressed=1;
create table innodb_compact(c1 bigint not null, b char(200)) engine=innodb row_format=compact encryption='ON' encryption_key_id=1 page_compressed=1;
create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic encryption='ON' encryption_key_id=2 page_compressed=1;
show warnings;
Level Code Message
show create table innodb_normal;
@@ -17,13 +17,13 @@ Table Create Table
innodb_compact CREATE TABLE `innodb_compact` (
`c1` bigint(20) NOT NULL,
`b` char(200) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT `page_encryption`=1 `page_encryption_key`=1 `page_compressed`=1
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT `encryption`='ON' `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 `page_encryption`=1 `page_encryption_key`=2 `page_compressed`=1
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC `encryption`='ON' `encryption_key_id`=2 `page_compressed`=1
create procedure innodb_insert_proc (repeat_count int)
begin
declare current_num int;
@@ -60,21 +60,16 @@ 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_page_encrypted';
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_page_decrypted';
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_encryption_error';
variable_value = 0
1
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_compressed';
variable_value >= 0
1
SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_decompressed';
SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_decompressed';
variable_value >= 0
1
SET GLOBAL innodb_file_format = `Barracuda`;
SET GLOBAL innodb_file_per_table = ON;
set global innodb_compression_algorithm = 1;
@@ -98,21 +93,16 @@ 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_page_encrypted';
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_page_decrypted';
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_encryption_error';
variable_value = 0
1
SELECT variable_value > 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_compressed';
variable_value > 0
1
SELECT variable_value > 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_decompressed';
variable_value > 0
1
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
@@ -120,14 +110,14 @@ innodb_normal CREATE TABLE `innodb_normal` (
`c1` bigint(20) NOT NULL,
`b` char(200) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
alter table innodb_compact engine=innodb page_encryption=DEFAULT page_encryption_key=DEFAULT page_compressed=DEFAULT;
alter table innodb_compact engine=innodb encryption=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 page_encryption=DEFAULT page_encryption_key=DEFAULT page_compressed=DEFAULT;
alter table innodb_dynamic engine=innodb encryption=DEFAULT encryption_key_id=DEFAULT page_compressed=DEFAULT;
show create table innodb_dynamic;
Table Create Table
innodb_dynamic CREATE TABLE `innodb_dynamic` (
@@ -174,21 +164,16 @@ 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_page_encrypted';
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_page_decrypted';
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_encryption_error';
SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_compressed';
variable_value = 0
1
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_decompressed';
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;

View File

@@ -4,34 +4,34 @@ call mtr.add_suppression("InnoDB: Redo log crypto: Can't initialize to key versi
SET GLOBAL innodb_file_format = `Barracuda`;
SET GLOBAL innodb_file_per_table = ON;
create table innodb_normal(c1 bigint not null, b char(200)) engine=innodb;
create table innodb_compact(c1 bigint not null, b char(200)) engine=innodb row_format=compact page_encryption=1 page_encryption_key=1;
create table innodb_compressed(c1 bigint not null, b char(200)) engine=innodb row_format=compressed page_encryption=1 page_encryption_key=2;
create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic page_encryption=1 page_encryption_key=3;
create table innodb_redundant(c1 bigint not null, b char(200)) engine=innodb row_format=redundant page_encryption=1 page_encryption_key=4;
create table innodb_compact(c1 bigint not null, b char(200)) engine=innodb row_format=compact encryption='ON' encryption_key_id=1;
create table innodb_compressed(c1 bigint not null, b char(200)) engine=innodb row_format=compressed encryption='ON' encryption_key_id=2;
create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic encryption='ON' encryption_key_id=3;
create table innodb_redundant(c1 bigint not null, b char(200)) engine=innodb row_format=redundant encryption='ON' 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 `page_encryption`=1 `page_encryption_key`=1
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT `encryption`='ON' `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 `page_encryption`=1 `page_encryption_key`=2
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED `encryption`='ON' `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 `page_encryption`=1 `page_encryption_key`=3
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC `encryption`='ON' `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 `page_encryption`=1 `page_encryption_key`=4
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT `encryption`='ON' `encryption_key_id`=4
create procedure innodb_insert_proc (repeat_count int)
begin
declare current_num int;
@@ -83,15 +83,12 @@ 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_page_encrypted';
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_page_decrypted';
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_encryption_error';
variable_value = 0
1
SET GLOBAL innodb_file_format = `Barracuda`;
SET GLOBAL innodb_file_per_table = ON;
update innodb_normal set c1 = c1 +1;
@@ -127,37 +124,34 @@ 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_page_encrypted';
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_page_decrypted';
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_encryption_error';
variable_value = 0
1
alter table innodb_compact engine=innodb page_encryption=DEFAULT page_encryption_key=DEFAULT;
alter table innodb_compact engine=innodb encryption=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 page_encryption=DEFAULT page_encryption_key=DEFAULT;
alter table innodb_compressed engine=innodb encryption=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 page_encryption=DEFAULT page_encryption_key=DEFAULT;
alter table innodb_dynamic engine=innodb encryption=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 page_encryption=DEFAULT page_encryption_key=DEFAULT;
alter table innodb_redundant engine=innodb encryption=DEFAULT encryption_key_id=DEFAULT;
show create table innodb_redundant;
Table Create Table
innodb_redundant CREATE TABLE `innodb_redundant` (
@@ -223,13 +217,10 @@ 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_page_encrypted';
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_page_decrypted';
variable_value = 0
1
SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_encryption_error';
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;

View File

@@ -1,9 +1,3 @@
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;
ERROR HY000: Can't create table `test`.`innodb_normal` (errno: 140 "Wrong create options")
create table innodb_compact(c1 bigint not null, b char(200)) engine=innodb row_format=compact page_compressed=1;
ERROR HY000: Can't create table `test`.`innodb_compact` (errno: 140 "Wrong create options")
create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic page_compressed=1;
ERROR HY000: Can't create table `test`.`innodb_dynamic` (errno: 140 "Wrong create options")

View File

@@ -66,15 +66,12 @@ SET GLOBAL innodb_encryption_threads=4;
# Success!
# Wait max 10 min for key encryption threads to decrypt all space
# Success!
SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_encrypted';
SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_encrypted';
variable_value >= 0
1
SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_decrypted';
SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_decrypted';
variable_value >= 0
1
SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_encryption_error';
variable_value = 0
1
SELECT variable_value > 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_compressed';
variable_value > 0
0

View File

@@ -91,15 +91,12 @@ 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_page_encrypted';
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_page_decrypted';
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_encryption_error';
variable_value = 0
1
SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_compressed';
variable_value >= 0
1
@@ -144,21 +141,18 @@ 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_page_encrypted';
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_page_decrypted';
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_encryption_error';
variable_value = 0
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
SELECT variable_value > 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_compressed';
variable_value > 0
0
SELECT variable_value > 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_decompressed';
variable_value > 0
0
drop procedure innodb_insert_proc;
drop table innodb_normal;
drop table innodb_compact;

View File

@@ -180,9 +180,8 @@ compress_page_compressed_trim_op disabled
compress_page_compressed_trim_op_saved disabled
compress_pages_page_decompressed disabled
compress_pages_page_compression_error disabled
compress_pages_page_encrypted disabled
compress_pages_page_decrypted disabled
compress_pages_page_encryption_error disabled
compress_pages_encrypted disabled
compress_pages_decrypted disabled
index_page_splits disabled
index_page_merge_attempts disabled
index_page_merge_successful disabled

View File

@@ -1,7 +1,9 @@
--source include/no_valgrind_without_big.inc
--source include/not_embedded.inc
# Tests for setting innodb-page-size=32k;
--source include/have_xtradb.inc
--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 *");
@@ -15,9 +17,9 @@ SET GLOBAL innodb_file_format = `Barracuda`;
SET GLOBAL innodb_file_per_table = ON;
create table innodb_normal(c1 bigint not null, b char(200)) engine=innodb;
create table innodb_compact(c1 bigint not null, b char(200)) engine=innodb row_format=compact page_encryption=1 page_encryption_key=1;
create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic page_encryption=1 page_encryption_key=3;
create table innodb_redundant(c1 bigint not null, b char(200)) engine=innodb row_format=redundant page_encryption=1 page_encryption_key=4;
create table innodb_compact(c1 bigint not null, b char(200)) engine=innodb row_format=compact encryption='ON' encryption_key_id=1;
create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic encryption='ON' encryption_key_id=3;
create table innodb_redundant(c1 bigint not null, b char(200)) engine=innodb row_format=redundant encryption='ON' encryption_key_id=4;
show create table innodb_compact;
show create table innodb_dynamic;
@@ -61,11 +63,11 @@ select count(*) from innodb_compact where c1 < 1500000;
select count(*) from innodb_dynamic where c1 < 1500000;
select count(*) from innodb_redundant where c1 < 1500000;
alter table innodb_compact engine=innodb page_encryption=0;
alter table innodb_compact engine=innodb encryption=DEFAULT encryption_key_id=DEFAULT;
show create table innodb_compact;
alter table innodb_dynamic engine=innodb page_encryption=0;
alter table innodb_dynamic engine=innodb encryption=DEFAULT encryption_key_id=DEFAULT;
show create table innodb_dynamic;
alter table innodb_redundant engine=innodb page_encryption=0;
alter table innodb_redundant engine=innodb encryption=DEFAULT encryption_key_id=DEFAULT;
show create table innodb_redundant;
--source include/restart_mysqld.inc

View File

@@ -4,20 +4,20 @@
--disable_query_log
let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
let $default_page_encryption_key = `SELECT @@innodb_default_page_encryption_key`;
let $default_encryption_key = `SELECT @@innodb_default_encryption_key`;
--enable_query_log
SET GLOBAL innodb_file_format = `Barracuda`;
SET GLOBAL innodb_file_per_table = ON;
create table innodb_normal(c1 bigint not null, b char(200)) engine=innodb;
create table innodb_compact(c1 bigint not null, b char(200)) engine=innodb row_format=compact page_encryption=1 page_encryption_key=1;
create table innodb_compressed(c1 bigint not null, b char(200)) engine=innodb row_format=compressed page_encryption=1 page_encryption_key=2;
create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic page_encryption=1 page_encryption_key=3;
create table innodb_redundant(c1 bigint not null, b char(200)) engine=innodb row_format=redundant page_encryption=1 page_encryption_key=4;
create table innodb_compact(c1 bigint not null, b char(200)) engine=innodb row_format=compact encryption='ON' encryption_key_id=1;
create table innodb_compressed(c1 bigint not null, b char(200)) engine=innodb row_format=compressed encryption='ON' encryption_key_id=2;
create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic encryption='ON' encryption_key_id=3;
create table innodb_redundant(c1 bigint not null, b char(200)) engine=innodb row_format=redundant encryption='ON' encryption_key_id=4;
SET GLOBAL innodb_default_page_encryption_key = 5;
create table innodb_defkey(c1 bigint not null, b char(200)) engine=innodb page_encryption=1;
SET GLOBAL innodb_default_encryption_key = 5;
create table innodb_defkey(c1 bigint not null, b char(200)) engine=innodb encryption='ON';
show create table innodb_defkey;
show create table innodb_compact;
@@ -73,9 +73,8 @@ 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_page_encrypted';
SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_decrypted';
SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_encryption_error';
SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_encrypted';
SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_decrypted';
--source include/restart_mysqld.inc
@@ -104,17 +103,16 @@ 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_page_encrypted';
SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_decrypted';
SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_encryption_error';
SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_encrypted';
SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_decrypted';
alter table innodb_compact engine=innodb page_encryption=DEFAULT page_encryption_key=DEFAULT;
alter table innodb_compact engine=innodb encryption=DEFAULT encryption_key_id=DEFAULT;
show create table innodb_compact;
alter table innodb_compressed engine=innodb page_encryption=DEFAULT page_encryption_key=DEFAULT;
alter table innodb_compressed engine=innodb encryption=DEFAULT encryption_key_id=DEFAULT;
show create table innodb_compressed;
alter table innodb_dynamic engine=innodb page_encryption=DEFAULT page_encryption_key=DEFAULT;
alter table innodb_dynamic engine=innodb encryption=DEFAULT encryption_key_id=DEFAULT;
show create table innodb_dynamic;
alter table innodb_redundant engine=innodb page_encryption=DEFAULT page_encryption_key=DEFAULT;
alter table innodb_redundant engine=innodb encryption=DEFAULT encryption_key_id=DEFAULT;
show create table innodb_redundant;
--source include/restart_mysqld.inc
@@ -147,9 +145,8 @@ 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_page_encrypted';
SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_decrypted';
SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_encryption_error';
SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_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;
@@ -163,5 +160,5 @@ drop table innodb_defkey;
--disable_query_log
EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig;
EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig;
EVAL SET GLOBAL innodb_default_page_encryption_key = $default_page_encryption_key;
EVAL SET GLOBAL innodb_default_encryption_key = $default_encryption_key;
--enable_query_log

View File

@@ -1,4 +1,5 @@
-- source include/have_innodb.inc
-- source include/not_embedded.inc
-- source include/have_file_key_management_plugin.inc
--disable_query_log
@@ -13,8 +14,8 @@ SET GLOBAL innodb_file_per_table = ON;
set global innodb_compression_algorithm = 1;
create table innodb_normal(c1 bigint not null, b char(200)) engine=innodb page_compressed=1;
create table innodb_compact(c1 bigint not null, b char(200)) engine=innodb row_format=compact page_encryption=1 page_encryption_key=1 page_compressed=1;
create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic page_encryption=1 page_encryption_key=2 page_compressed=1;
create table innodb_compact(c1 bigint not null, b char(200)) engine=innodb row_format=compact encryption='ON' encryption_key_id=1 page_compressed=1;
create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic encryption='ON' encryption_key_id=2 page_compressed=1;
show warnings;
show create table innodb_normal;
@@ -53,11 +54,10 @@ 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_page_encrypted';
SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_decrypted';
SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_encryption_error';
SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_compressed';
SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_decompressed';
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
@@ -77,17 +77,16 @@ 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_page_encrypted';
SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_decrypted';
SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_encryption_error';
SELECT variable_value > 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_compressed';
SELECT variable_value > 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_decompressed';
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 page_encryption=DEFAULT page_encryption_key=DEFAULT page_compressed=DEFAULT;
alter table innodb_compact engine=innodb encryption=DEFAULT encryption_key_id=DEFAULT page_compressed=DEFAULT;
show create table innodb_compact;
alter table innodb_dynamic engine=innodb page_encryption=DEFAULT page_encryption_key=DEFAULT page_compressed=DEFAULT;
alter table innodb_dynamic engine=innodb encryption=DEFAULT encryption_key_id=DEFAULT page_compressed=DEFAULT;
show create table innodb_dynamic;
--source include/restart_mysqld.inc
@@ -110,11 +109,10 @@ 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_page_encrypted';
SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_decrypted';
SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_encryption_error';
SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_compressed';
SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_decompressed';
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;

View File

@@ -1,4 +1,5 @@
-- source include/have_innodb.inc
-- source include/not_embedded.inc
-- source include/have_file_key_management_plugin.inc
--disable_query_log
@@ -14,10 +15,10 @@ SET GLOBAL innodb_file_format = `Barracuda`;
SET GLOBAL innodb_file_per_table = ON;
create table innodb_normal(c1 bigint not null, b char(200)) engine=innodb;
create table innodb_compact(c1 bigint not null, b char(200)) engine=innodb row_format=compact page_encryption=1 page_encryption_key=1;
create table innodb_compressed(c1 bigint not null, b char(200)) engine=innodb row_format=compressed page_encryption=1 page_encryption_key=2;
create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic page_encryption=1 page_encryption_key=3;
create table innodb_redundant(c1 bigint not null, b char(200)) engine=innodb row_format=redundant page_encryption=1 page_encryption_key=4;
create table innodb_compact(c1 bigint not null, b char(200)) engine=innodb row_format=compact encryption='ON' encryption_key_id=1;
create table innodb_compressed(c1 bigint not null, b char(200)) engine=innodb row_format=compressed encryption='ON' encryption_key_id=2;
create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic encryption='ON' encryption_key_id=3;
create table innodb_redundant(c1 bigint not null, b char(200)) engine=innodb row_format=redundant encryption='ON' encryption_key_id=4;
show create table innodb_compact;
show create table innodb_compressed;
@@ -66,9 +67,8 @@ 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_page_encrypted';
SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_decrypted';
SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_encryption_error';
SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_encrypted';
SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_decrypted';
--source include/restart_mysqld.inc
@@ -93,17 +93,16 @@ 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_page_encrypted';
SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_decrypted';
SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_encryption_error';
SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_encrypted';
SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_decrypted';
alter table innodb_compact engine=innodb page_encryption=DEFAULT page_encryption_key=DEFAULT;
alter table innodb_compact engine=innodb encryption=DEFAULT encryption_key_id=DEFAULT;
show create table innodb_compact;
alter table innodb_compressed engine=innodb page_encryption=DEFAULT page_encryption_key=DEFAULT;
alter table innodb_compressed engine=innodb encryption=DEFAULT encryption_key_id=DEFAULT;
show create table innodb_compressed;
alter table innodb_dynamic engine=innodb page_encryption=DEFAULT page_encryption_key=DEFAULT;
alter table innodb_dynamic engine=innodb encryption=DEFAULT encryption_key_id=DEFAULT;
show create table innodb_dynamic;
alter table innodb_redundant engine=innodb page_encryption=DEFAULT page_encryption_key=DEFAULT;
alter table innodb_redundant engine=innodb encryption=DEFAULT encryption_key_id=DEFAULT;
show create table innodb_redundant;
--source include/restart_mysqld.inc
@@ -135,9 +134,8 @@ 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_page_encrypted';
SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_decrypted';
SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_encryption_error';
SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_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;

View File

@@ -15,16 +15,6 @@ SET GLOBAL innodb_file_per_table = ON;
# zlib
set global innodb_compression_algorithm = 1;
--replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
--error 1005
create table innodb_normal(c1 bigint not null, b char(200)) engine=innodb page_compressed=1;
--replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
--error 1005
create table innodb_compact(c1 bigint not null, b char(200)) engine=innodb row_format=compact page_compressed=1;
--replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
--error 1005
create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic page_compressed=1;
# reset system
--disable_query_log
EVAL SET GLOBAL innodb_compression_algorithm = $innodb_compression_algorithm_orig;

View File

@@ -205,9 +205,8 @@ if (!$success)
}
--echo # Success!
SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_encrypted';
SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_decrypted';
SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_encryption_error';
SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_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';

View File

@@ -66,9 +66,8 @@ 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_page_encrypted';
SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_decrypted';
SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_encryption_error';
SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_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';
@@ -96,11 +95,10 @@ 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_page_encrypted';
SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_decrypted';
SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_encryption_error';
SELECT variable_value > 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_compressed';
SELECT variable_value > 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_decompressed';
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;

View File

@@ -10,6 +10,7 @@ there should be *no* long test name listed below:
select distinct variable_name as `there should be *no* variables listed below:` from t2
left join t1 on variable_name=test_name where test_name is null;
there should be *no* variables listed below:
innodb_default_encryption_key
strict_password_validation
drop table t1;
drop table t2;

View File

@@ -1,71 +1,71 @@
SET @start_global_value = @@global.innodb_default_page_encryption_key;
SET @start_global_value = @@global.innodb_default_encryption_key;
SELECT @start_global_value;
@start_global_value
1
Valid value 0-9
select @@global.innodb_default_page_encryption_key <= 9;
@@global.innodb_default_page_encryption_key <= 9
select @@global.innodb_default_encryption_key <= 9;
@@global.innodb_default_encryption_key <= 9
1
select @@global.innodb_default_page_encryption_key;
@@global.innodb_default_page_encryption_key
select @@global.innodb_default_encryption_key;
@@global.innodb_default_encryption_key
1
select @@session.innodb_default_page_encryption_key;
ERROR HY000: Variable 'innodb_default_page_encryption_key' is a GLOBAL variable
show global variables like 'innodb_default_page_encryption_key';
select @@session.innodb_default_encryption_key;
ERROR HY000: Variable 'innodb_default_encryption_key' is a GLOBAL variable
show global variables like 'innodb_default_encryption_key';
Variable_name Value
innodb_default_page_encryption_key 1
show session variables like 'innodb_default_page_encryption_key';
innodb_default_encryption_key 1
show session variables like 'innodb_default_encryption_key';
Variable_name Value
innodb_default_page_encryption_key 1
select * from information_schema.global_variables where variable_name='innodb_default_page_encryption_key';
innodb_default_encryption_key 1
select * from information_schema.global_variables where variable_name='innodb_default_encryption_key';
VARIABLE_NAME VARIABLE_VALUE
INNODB_DEFAULT_PAGE_ENCRYPTION_KEY 1
select * from information_schema.session_variables where variable_name='innodb_default_page_encryption_key';
INNODB_DEFAULT_ENCRYPTION_KEY 1
select * from information_schema.session_variables where variable_name='innodb_default_encryption_key';
VARIABLE_NAME VARIABLE_VALUE
INNODB_DEFAULT_PAGE_ENCRYPTION_KEY 1
set global innodb_default_page_encryption_key=2;
select @@global.innodb_default_page_encryption_key;
@@global.innodb_default_page_encryption_key
INNODB_DEFAULT_ENCRYPTION_KEY 1
set global innodb_default_encryption_key=2;
select @@global.innodb_default_encryption_key;
@@global.innodb_default_encryption_key
2
select * from information_schema.global_variables where variable_name='innodb_default_page_encryption_key';
select * from information_schema.global_variables where variable_name='innodb_default_encryption_key';
VARIABLE_NAME VARIABLE_VALUE
INNODB_DEFAULT_PAGE_ENCRYPTION_KEY 2
select * from information_schema.session_variables where variable_name='innodb_default_page_encryption_key';
INNODB_DEFAULT_ENCRYPTION_KEY 2
select * from information_schema.session_variables where variable_name='innodb_default_encryption_key';
VARIABLE_NAME VARIABLE_VALUE
INNODB_DEFAULT_PAGE_ENCRYPTION_KEY 2
set session innodb_default_page_encryption_key=4;
ERROR HY000: Variable 'innodb_default_page_encryption_key' is a GLOBAL variable and should be set with SET GLOBAL
set global innodb_default_page_encryption_key=1.1;
ERROR 42000: Incorrect argument type to variable 'innodb_default_page_encryption_key'
set global innodb_default_page_encryption_key=1e1;
ERROR 42000: Incorrect argument type to variable 'innodb_default_page_encryption_key'
set global innodb_default_page_encryption_key="foo";
ERROR 42000: Incorrect argument type to variable 'innodb_default_page_encryption_key'
set global innodb_default_page_encryption_key=10;
select @@global.innodb_default_page_encryption_key;
@@global.innodb_default_page_encryption_key
INNODB_DEFAULT_ENCRYPTION_KEY 2
set session innodb_default_encryption_key=4;
ERROR HY000: Variable 'innodb_default_encryption_key' is a GLOBAL variable and should be set with SET GLOBAL
set global innodb_default_encryption_key=1.1;
ERROR 42000: Incorrect argument type to variable 'innodb_default_encryption_key'
set global innodb_default_encryption_key=1e1;
ERROR 42000: Incorrect argument type to variable 'innodb_default_encryption_key'
set global innodb_default_encryption_key="foo";
ERROR 42000: Incorrect argument type to variable 'innodb_default_encryption_key'
set global innodb_default_encryption_key=10;
select @@global.innodb_default_encryption_key;
@@global.innodb_default_encryption_key
10
select * from information_schema.global_variables where variable_name='innodb_default_page_encryption_key';
select * from information_schema.global_variables where variable_name='innodb_default_encryption_key';
VARIABLE_NAME VARIABLE_VALUE
INNODB_DEFAULT_PAGE_ENCRYPTION_KEY 10
set global innodb_default_page_encryption_key=-7;
INNODB_DEFAULT_ENCRYPTION_KEY 10
set global innodb_default_encryption_key=-7;
Warnings:
Warning 1292 Truncated incorrect innodb_default_page_encryption_k value: '-7'
select @@global.innodb_default_page_encryption_key;
@@global.innodb_default_page_encryption_key
Warning 1292 Truncated incorrect innodb_default_encryption_key value: '-7'
select @@global.innodb_default_encryption_key;
@@global.innodb_default_encryption_key
1
select * from information_schema.global_variables where variable_name='innodb_default_page_encryption_key';
select * from information_schema.global_variables where variable_name='innodb_default_encryption_key';
VARIABLE_NAME VARIABLE_VALUE
INNODB_DEFAULT_PAGE_ENCRYPTION_KEY 1
set global innodb_default_page_encryption_key=1;
select @@global.innodb_default_page_encryption_key;
@@global.innodb_default_page_encryption_key
INNODB_DEFAULT_ENCRYPTION_KEY 1
set global innodb_default_encryption_key=1;
select @@global.innodb_default_encryption_key;
@@global.innodb_default_encryption_key
1
set global innodb_default_page_encryption_key=255;
select @@global.innodb_default_page_encryption_key;
@@global.innodb_default_page_encryption_key
set global innodb_default_encryption_key=255;
select @@global.innodb_default_encryption_key;
@@global.innodb_default_encryption_key
255
SET @@global.innodb_default_page_encryption_key = @start_global_value;
SELECT @@global.innodb_default_page_encryption_key;
@@global.innodb_default_page_encryption_key
SET @@global.innodb_default_encryption_key = @start_global_value;
SELECT @@global.innodb_default_encryption_key;
@@global.innodb_default_encryption_key
1

View File

@@ -180,9 +180,8 @@ compress_page_compressed_trim_op disabled
compress_page_compressed_trim_op_saved disabled
compress_pages_page_decompressed disabled
compress_pages_page_compression_error disabled
compress_pages_page_encrypted disabled
compress_pages_page_decrypted disabled
compress_pages_page_encryption_error disabled
compress_pages_encrypted disabled
compress_pages_decrypted disabled
index_page_splits disabled
index_page_merge_attempts disabled
index_page_merge_successful disabled

View File

@@ -180,9 +180,8 @@ compress_page_compressed_trim_op disabled
compress_page_compressed_trim_op_saved disabled
compress_pages_page_decompressed disabled
compress_pages_page_compression_error disabled
compress_pages_page_encrypted disabled
compress_pages_page_decrypted disabled
compress_pages_page_encryption_error disabled
compress_pages_encrypted disabled
compress_pages_decrypted disabled
index_page_splits disabled
index_page_merge_attempts disabled
index_page_merge_successful disabled

View File

@@ -180,9 +180,8 @@ compress_page_compressed_trim_op disabled
compress_page_compressed_trim_op_saved disabled
compress_pages_page_decompressed disabled
compress_pages_page_compression_error disabled
compress_pages_page_encrypted disabled
compress_pages_page_decrypted disabled
compress_pages_page_encryption_error disabled
compress_pages_encrypted disabled
compress_pages_decrypted disabled
index_page_splits disabled
index_page_merge_attempts disabled
index_page_merge_successful disabled

View File

@@ -180,9 +180,8 @@ compress_page_compressed_trim_op disabled
compress_page_compressed_trim_op_saved disabled
compress_pages_page_decompressed disabled
compress_pages_page_compression_error disabled
compress_pages_page_encrypted disabled
compress_pages_page_decrypted disabled
compress_pages_page_encryption_error disabled
compress_pages_encrypted disabled
compress_pages_decrypted disabled
index_page_splits disabled
index_page_merge_attempts disabled
index_page_merge_successful disabled

View File

@@ -565,16 +565,16 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST NULL
READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME INNODB_DEFAULT_PAGE_ENCRYPTION_KEY
VARIABLE_NAME INNODB_DEFAULT_ENCRYPTION_KEY
SESSION_VALUE NULL
GLOBAL_VALUE 1
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 1
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Encryption key used for page encryption.
VARIABLE_COMMENT Default encryption key used for table encryption.
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 255
NUMERIC_MAX_VALUE 4294967295
NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
READ_ONLY NO

View File

@@ -1,60 +1,60 @@
--source include/have_innodb.inc
SET @start_global_value = @@global.innodb_default_page_encryption_key;
SET @start_global_value = @@global.innodb_default_encryption_key;
SELECT @start_global_value;
#
# exists as global only
#
--echo Valid value 0-9
select @@global.innodb_default_page_encryption_key <= 9;
select @@global.innodb_default_page_encryption_key;
select @@global.innodb_default_encryption_key <= 9;
select @@global.innodb_default_encryption_key;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
select @@session.innodb_default_page_encryption_key;
show global variables like 'innodb_default_page_encryption_key';
show session variables like 'innodb_default_page_encryption_key';
select * from information_schema.global_variables where variable_name='innodb_default_page_encryption_key';
select * from information_schema.session_variables where variable_name='innodb_default_page_encryption_key';
select @@session.innodb_default_encryption_key;
show global variables like 'innodb_default_encryption_key';
show session variables like 'innodb_default_encryption_key';
select * from information_schema.global_variables where variable_name='innodb_default_encryption_key';
select * from information_schema.session_variables where variable_name='innodb_default_encryption_key';
#
# show that it's writable
#
set global innodb_default_page_encryption_key=2;
select @@global.innodb_default_page_encryption_key;
select * from information_schema.global_variables where variable_name='innodb_default_page_encryption_key';
select * from information_schema.session_variables where variable_name='innodb_default_page_encryption_key';
set global innodb_default_encryption_key=2;
select @@global.innodb_default_encryption_key;
select * from information_schema.global_variables where variable_name='innodb_default_encryption_key';
select * from information_schema.session_variables where variable_name='innodb_default_encryption_key';
--error ER_GLOBAL_VARIABLE
set session innodb_default_page_encryption_key=4;
set session innodb_default_encryption_key=4;
#
# incorrect types
#
--error ER_WRONG_TYPE_FOR_VAR
set global innodb_default_page_encryption_key=1.1;
set global innodb_default_encryption_key=1.1;
--error ER_WRONG_TYPE_FOR_VAR
set global innodb_default_page_encryption_key=1e1;
set global innodb_default_encryption_key=1e1;
--error ER_WRONG_TYPE_FOR_VAR
set global innodb_default_page_encryption_key="foo";
set global innodb_default_encryption_key="foo";
set global innodb_default_page_encryption_key=10;
select @@global.innodb_default_page_encryption_key;
select * from information_schema.global_variables where variable_name='innodb_default_page_encryption_key';
set global innodb_default_page_encryption_key=-7;
select @@global.innodb_default_page_encryption_key;
select * from information_schema.global_variables where variable_name='innodb_default_page_encryption_key';
set global innodb_default_encryption_key=10;
select @@global.innodb_default_encryption_key;
select * from information_schema.global_variables where variable_name='innodb_default_encryption_key';
set global innodb_default_encryption_key=-7;
select @@global.innodb_default_encryption_key;
select * from information_schema.global_variables where variable_name='innodb_default_encryption_key';
#
# min/max values
#
set global innodb_default_page_encryption_key=1;
select @@global.innodb_default_page_encryption_key;
set global innodb_default_page_encryption_key=255;
select @@global.innodb_default_page_encryption_key;
set global innodb_default_encryption_key=1;
select @@global.innodb_default_encryption_key;
set global innodb_default_encryption_key=255;
select @@global.innodb_default_encryption_key;
#
# cleanup
#
SET @@global.innodb_default_page_encryption_key = @start_global_value;
SELECT @@global.innodb_default_page_encryption_key;
SET @@global.innodb_default_encryption_key = @start_global_value;
SELECT @@global.innodb_default_encryption_key;

View File

@@ -5710,6 +5710,7 @@ buf_page_encrypt_before_write(
ulint space_id) /*!< in: space id */
{
fil_space_crypt_t* crypt_data = fil_space_get_crypt_data(space_id);
bpage->real_size = UNIV_PAGE_SIZE;
if (crypt_data != NULL && crypt_data->encryption == FIL_SPACE_ENCRYPTION_OFF) {
/* Encryption is disabled */
@@ -5763,7 +5764,7 @@ buf_page_encrypt_before_write(
mach_read_from_4(dst_frame + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION);
ut_ad(key_version == 0 || key_version >= bpage->key_version);
bpage->key_version = key_version;
bpage->real_size = zip_size;
bpage->real_size = page_size;
} else {
/* First we compress the page content */
ulint out_len = 0;

View File

@@ -647,20 +647,6 @@ fil_node_open_file(
success = os_file_read(node->handle, page, 0, UNIV_PAGE_SIZE);
if (fil_page_is_encrypted(page)) {
/* if page is (still) encrypted, write an error and return.
* Otherwise the server would crash if decrypting is not possible.
* This may be the case, if the key file could not be
* opened on server startup.
*/
ib_logf(IB_LOG_LEVEL_ERROR,
"InnoDB: can not decrypt page, because "
"keys could not be read.\n"
);
return false;
}
space_id = fsp_header_get_space_id(page);
flags = fsp_header_get_flags(page);
@@ -1896,7 +1882,6 @@ fil_check_first_page(
{
ulint space_id;
ulint flags;
ulint page_is_encrypted;
if (srv_force_recovery >= SRV_FORCE_IGNORE_CORRUPT) {
return(NULL);
@@ -1904,12 +1889,7 @@ fil_check_first_page(
space_id = mach_read_from_4(FSP_HEADER_OFFSET + FSP_SPACE_ID + page);
flags = mach_read_from_4(FSP_HEADER_OFFSET + FSP_SPACE_FLAGS + page);
/* Note: the 1st page is usually not encrypted. If the Key Provider
or the encryption key is not available, the
check for reading the first page should intentionally fail
with "can not decrypt" message. */
page_is_encrypted = fil_page_encryption_status(page, space_id);
if (!page_is_encrypted) {
if (UNIV_PAGE_SIZE != fsp_flags_get_page_size(flags)) {
fprintf(stderr,
"InnoDB: Error: Current page size %lu != "
@@ -1918,7 +1898,6 @@ fil_check_first_page(
return("innodb-page-size mismatch");
}
}
if (!space_id && !flags) {
ulint nonzero_bytes = UNIV_PAGE_SIZE;
@@ -1933,17 +1912,9 @@ fil_check_first_page(
}
}
if (!page_is_encrypted && buf_page_is_corrupted(
if (buf_page_is_corrupted(
false, page, fsp_flags_get_zip_size(flags))) {
return("checksum mismatch");
} else {
if (page_is_encrypted) {
/* this error message is interpreted by the calling method, which is
* executed if the server starts in recovery mode.
*/
return(FIL_MSG_CANNOT_DECRYPT);
}
}
if (page_get_space_id(page) == space_id
@@ -1987,6 +1958,7 @@ fil_read_first_page(
byte* page;
lsn_t flushed_lsn;
const char* check_msg = NULL;
fil_space_crypt_t* cdata;
buf = static_cast<byte*>(ut_malloc(2 * UNIV_PAGE_SIZE));
@@ -2005,13 +1977,6 @@ fil_read_first_page(
*space_id = fsp_header_get_space_id(page);
}
/* Page is page compressed page, need to decompress, before
continue. */
if (fil_page_is_compressed(page)) {
ulint write_size=0;
fil_decompress_page(NULL, page, UNIV_PAGE_SIZE, &write_size);
}
if (!one_read_already) {
check_msg = fil_check_first_page(page);
}
@@ -2019,12 +1984,29 @@ fil_read_first_page(
flushed_lsn = mach_read_from_8(page +
FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION);
if (crypt_data) {
ulint space = fsp_header_get_space_id(page);
ulint offset =
fsp_header_get_crypt_offset(
ulint offset = fsp_header_get_crypt_offset(
fsp_flags_get_zip_size(*flags), NULL);
*crypt_data = fil_space_read_crypt_data(space, page, offset);
cdata = fil_space_read_crypt_data(space, page, offset);
/* If file space is encrypted we need to have at least some
encryption service available where to get keys */
if ((cdata && cdata->encryption == FIL_SPACE_ENCRYPTION_ON) ||
( srv_encrypt_tables &&
cdata && cdata->encryption == FIL_SPACE_ENCRYPTION_DEFAULT)) {
int rc = get_latest_encryption_key_version();
if (rc < 0) {
ib_logf(IB_LOG_LEVEL_FATAL,
"Tablespace id %ld encrypted but encryption service"
" not available. Can't continue opening tablespace.\n",
space);
ut_error;
}
}
if (crypt_data) {
*crypt_data = cdata;
}
ut_free(buf);
@@ -4203,14 +4185,6 @@ check_first_page:
"%s in tablespace %s (table %s)",
check_msg, fsp->filepath, tablename);
fsp->success = FALSE;
if (strncmp(check_msg, FIL_MSG_CANNOT_DECRYPT, strlen(check_msg))==0) {
/* by returning here, it should be avoided, that the server crashes,
* if started in recovery mode and can not decrypt tables, if
* the key file can not be read.
*/
fsp->encryption_error = 1;
return;
}
}
if (!fsp->success) {

View File

@@ -569,7 +569,7 @@ ha_create_table_option innodb_table_option_list[]=
/* With this option the user can enable encryption for the table */
HA_TOPTION_ENUM("ENCRYPTION", encryption, "DEFAULT,ON,OFF", 0),
/* With this option the user defines the key identifier using for the encryption */
HA_TOPTION_NUMBER("ENCRYPTION_KEY", encryption_key, 0, 1, UINT_MAX32, 1),
HA_TOPTION_NUMBER("ENCRYPTION_KEY_ID", encryption_key_id, 0, 1, UINT_MAX32, 1),
HA_TOPTION_END
};
@@ -11375,29 +11375,19 @@ ha_innobase::check_table_options(
}
}
if (options->encryption_key != 0) {
if (options->encryption_key_id != 0) {
if (options->encryption == FIL_SPACE_ENCRYPTION_OFF) {
/* ignore this to allow alter table without changing page_encryption_key ...*/
}
if (options->encryption_key < 1) {
if (!has_encryption_key(options->encryption_key_id)) {
push_warning_printf(
thd, Sql_condition::WARN_LEVEL_WARN,
HA_WRONG_CREATE_OPTION,
"InnoDB: invalid ENCRYPTION_KEY = %lu."
" Valid values are [1..INT32_MAX]",
options->encryption_key);
return "ENCRYPTION_KEY";
}
if (!has_encryption_key(options->encryption_key)) {
push_warning_printf(
thd, Sql_condition::WARN_LEVEL_WARN,
HA_WRONG_CREATE_OPTION,
"InnoDB: ENCRYPTION_KEY encryption key %lu not available",
options->encryption_key
"InnoDB: ENCRYPTION_KEY_ID key %lu not available",
options->encryption_key_id
);
return "ENCRYPTION_KEY";
return "ENCRYPTION_KEY_ID";
}
}
@@ -11459,10 +11449,10 @@ ha_innobase::create(
const char* stmt;
size_t stmt_len;
/* Cache table options */
ha_table_option_struct *options= table->s->option_struct;
ha_table_option_struct *options= form->s->option_struct;
fil_encryption_t encrypt = (fil_encryption_t)options->encryption;
ulint key_id = (options->encryption_key == 0) ? srv_default_encryption_key :
options->encryption_key;
ulint key_id = (options->encryption_key_id == 0) ? srv_default_encryption_key :
options->encryption_key_id;
DBUG_ENTER("ha_innobase::create");
@@ -11702,18 +11692,6 @@ ha_innobase::create(
innobase_commit_low(trx);
/* If user has requested that table should be encrypted or table
should remain as unencrypted store crypt data */
if (encrypt == FIL_SPACE_ENCRYPTION_ON || encrypt == FIL_SPACE_ENCRYPTION_OFF) {
ulint maxsize;
ulint zip_size = fil_space_get_zip_size(innobase_table->space);
fil_space_crypt_t* crypt_data = fil_space_create_crypt_data();
crypt_data->page0_offset = fsp_header_get_crypt_offset(zip_size, &maxsize);
crypt_data->keys[0].key_id = key_id;
crypt_data->encryption = encrypt;
fil_space_set_crypt_data(innobase_table->space, crypt_data);
}
row_mysql_unlock_data_dictionary(trx);
/* Flush the log to reduce probability that the .frm files and
@@ -11727,6 +11705,28 @@ ha_innobase::create(
DBUG_ASSERT(innobase_table != 0);
/* If user has requested that table should be encrypted or table
should remain as unencrypted store crypt data */
if (encrypt == FIL_SPACE_ENCRYPTION_ON || encrypt == FIL_SPACE_ENCRYPTION_OFF) {
ulint maxsize;
ulint zip_size = fil_space_get_zip_size(innobase_table->space);
fil_space_crypt_t* old_crypt_data = fil_space_get_crypt_data(innobase_table->space);
fil_space_crypt_t* crypt_data;
crypt_data = fil_space_create_crypt_data();
crypt_data->page0_offset = fsp_header_get_crypt_offset(zip_size, &maxsize);
crypt_data->keys[0].key_id = key_id;
crypt_data->encryption = encrypt;
/* If there is old crypt data, copy IV */
if (old_crypt_data) {
memcpy(crypt_data->iv, old_crypt_data->iv, old_crypt_data->iv_length);
crypt_data->iv_length = old_crypt_data->iv_length;
}
fil_space_set_crypt_data(innobase_table->space, crypt_data);
}
innobase_copy_frm_flags_from_create_info(innobase_table, create_info);
dict_stats_update(innobase_table, DICT_STATS_EMPTY_TABLE);

View File

@@ -71,7 +71,7 @@ struct ha_table_option_struct
Atomic writes are not used if
value OFF.*/
uint encryption; /*!< DEFAULT, ON, OFF */
int encryption_key; /*!< encryption key id*/
int encryption_key_id; /*!< encryption key id*/
};

View File

@@ -279,7 +279,7 @@ ha_innobase::check_if_supported_inplace_alter(
}
if (new_options->encryption != old_options->encryption ||
new_options->encryption_key != old_options->encryption_key) {
new_options->encryption_key_id != old_options->encryption_key_id) {
ha_alter_info->unsupported_reason = innobase_get_err_msg(
ER_ALTER_OPERATION_NOT_SUPPORTED_REASON);
DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED);

View File

@@ -159,7 +159,7 @@ void
fil_space_set_crypt_data(
/*======================*/
ulint space, /*!< in: tablespace id */
fil_space_crypt_t* crypt_data); /*!< in: crypt data */
fil_space_crypt_t* crypt_data); /*!< in: crypt data to set */
/*********************************************************************
Compare crypt data*/

View File

@@ -1024,8 +1024,7 @@ struct export_var_t{
decrypted */
ulint innodb_sec_rec_cluster_reads; /*!< srv_sec_rec_cluster_reads */
ulint innodb_sec_rec_cluster_reads_avoided;
/*!< srv_sec_rec_cluster_reads_avoided */
ulint innodb_sec_rec_cluster_reads_avoided;/*!< srv_sec_rec_cluster_reads_avoided */
ulint innodb_encryption_rotation_pages_read_from_cache;
ulint innodb_encryption_rotation_pages_read_from_disk;

View File

@@ -5868,6 +5868,7 @@ buf_page_encrypt_before_write(
ulint space_id) /*!< in: space id */
{
fil_space_crypt_t* crypt_data = fil_space_get_crypt_data(space_id);
bpage->real_size = UNIV_PAGE_SIZE;
if (crypt_data != NULL && crypt_data->encryption == FIL_SPACE_ENCRYPTION_OFF) {
/* Encryption is disabled */
@@ -5921,7 +5922,7 @@ buf_page_encrypt_before_write(
mach_read_from_4(dst_frame + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION);
ut_ad(key_version == 0 || key_version >= bpage->key_version);
bpage->key_version = key_version;
bpage->real_size = zip_size;
bpage->real_size = page_size;
} else {
/* First we compress the page content */
ulint out_len = 0;

View File

@@ -634,7 +634,7 @@ ha_create_table_option innodb_table_option_list[]=
/* With this option the user can enable encryption for the table */
HA_TOPTION_ENUM("ENCRYPTION", encryption, "DEFAULT,ON,OFF", 0),
/* With this option the user defines the key identifier using for the encryption */
HA_TOPTION_NUMBER("ENCRYPTION_KEY", encryption_key, 0, 1, UINT_MAX32, 1),
HA_TOPTION_NUMBER("ENCRYPTION_KEY_ID", encryption_key_id, 0, 1, UINT_MAX32, 1),
HA_TOPTION_END
};
@@ -11882,29 +11882,19 @@ ha_innobase::check_table_options(
}
}
if (options->encryption_key != 0) {
if (options->encryption_key_id != 0) {
if (options->encryption == FIL_SPACE_ENCRYPTION_OFF) {
/* ignore this to allow alter table without changing page_encryption_key ...*/
}
if (options->encryption_key < 1) {
if (!has_encryption_key(options->encryption_key_id)) {
push_warning_printf(
thd, Sql_condition::WARN_LEVEL_WARN,
HA_WRONG_CREATE_OPTION,
"InnoDB: invalid ENCRYPTION_KEY = %lu."
" Valid values are [1..UINTMAX32]",
options->encryption_key);
return "ENCRYPTION_KEY";
}
if (!has_encryption_key(options->encryption_key)) {
push_warning_printf(
thd, Sql_condition::WARN_LEVEL_WARN,
HA_WRONG_CREATE_OPTION,
"InnoDB: ENCRYPTION_KEY %lu not available",
options->encryption_key
"InnoDB: ENCRYPTION_KEY_ID %lu not available",
options->encryption_key_id
);
return "ENCRYPTION_KEY";
return "ENCRYPTION_KEY_ID";
}
}
@@ -11967,10 +11957,10 @@ ha_innobase::create(
const char* stmt;
size_t stmt_len;
/* Cache table options */
ha_table_option_struct *options= table->s->option_struct;
ha_table_option_struct *options= form->s->option_struct;
fil_encryption_t encrypt = (fil_encryption_t)options->encryption;
ulint key_id = (options->encryption_key == 0) ? srv_default_encryption_key :
options->encryption_key;
ulint key_id = (options->encryption_key_id == 0) ? srv_default_encryption_key :
options->encryption_key_id;
DBUG_ENTER("ha_innobase::create");
@@ -12216,18 +12206,6 @@ ha_innobase::create(
innobase_commit_low(trx);
/* If user has requested that table should be encrypted or table
should remain as unencrypted store crypt data */
if (encrypt == FIL_SPACE_ENCRYPTION_ON || encrypt == FIL_SPACE_ENCRYPTION_OFF) {
ulint maxsize;
ulint zip_size = fil_space_get_zip_size(innobase_table->space);
fil_space_crypt_t* crypt_data = fil_space_create_crypt_data();
crypt_data->page0_offset = fsp_header_get_crypt_offset(zip_size, &maxsize);
crypt_data->keys[0].key_id = key_id;
crypt_data->encryption = encrypt;
fil_space_set_crypt_data(innobase_table->space, crypt_data);
}
row_mysql_unlock_data_dictionary(trx);
/* Flush the log to reduce probability that the .frm files and
@@ -12241,6 +12219,28 @@ ha_innobase::create(
DBUG_ASSERT(innobase_table != 0);
/* If user has requested that table should be encrypted or table
should remain as unencrypted store crypt data */
if (encrypt == FIL_SPACE_ENCRYPTION_ON || encrypt == FIL_SPACE_ENCRYPTION_OFF) {
ulint maxsize;
ulint zip_size = fil_space_get_zip_size(innobase_table->space);
fil_space_crypt_t* old_crypt_data = fil_space_get_crypt_data(innobase_table->space);
fil_space_crypt_t* crypt_data;
crypt_data = fil_space_create_crypt_data();
crypt_data->page0_offset = fsp_header_get_crypt_offset(zip_size, &maxsize);
crypt_data->keys[0].key_id = key_id;
crypt_data->encryption = encrypt;
/* If there is old crypt data, copy IV */
if (old_crypt_data) {
memcpy(crypt_data->iv, old_crypt_data->iv, old_crypt_data->iv_length);
crypt_data->iv_length = old_crypt_data->iv_length;
}
fil_space_set_crypt_data(innobase_table->space, crypt_data);
}
innobase_copy_frm_flags_from_create_info(innobase_table, create_info);
dict_stats_update(innobase_table, DICT_STATS_EMPTY_TABLE);
@@ -20339,7 +20339,7 @@ static MYSQL_SYSVAR_UINT(encryption_rotation_iops, srv_n_fil_crypt_iops,
static MYSQL_SYSVAR_UINT(default_encryption_key, srv_default_encryption_key,
PLUGIN_VAR_RQCMDARG,
"Default encryption key used for table encryption.",
"Default encryption key id used for table encryption.",
NULL,
NULL,
FIL_DEFAULT_ENCRYPTION_KEY, 1, UINT_MAX32, 0);

View File

@@ -72,7 +72,7 @@ struct ha_table_option_struct
Atomic writes are not used if
value OFF.*/
uint encryption; /*!< DEFAULT, ON, OFF */
int encryption_key; /*!< encryption key id */
int encryption_key_id; /*!< encryption key id */
};
/** The class defining a handle to an Innodb table */

View File

@@ -283,7 +283,7 @@ ha_innobase::check_if_supported_inplace_alter(
}
if (new_options->encryption != old_options->encryption ||
new_options->encryption_key != old_options->encryption_key) {
new_options->encryption_key_id != old_options->encryption_key_id) {
ha_alter_info->unsupported_reason = innobase_get_err_msg(
ER_ALTER_OPERATION_NOT_SUPPORTED_REASON);
DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED);

View File

@@ -159,7 +159,7 @@ void
fil_space_set_crypt_data(
/*======================*/
ulint space, /*!< in: tablespace id */
fil_space_crypt_t* crypt_data); /*!< in: crypt data */
fil_space_crypt_t* crypt_data); /*!< in: crypt data to set */
/*********************************************************************
Compare crypt data*/

View File

@@ -94,8 +94,8 @@ dictionary */
#define FSP_FLAGS_POS_ATOMIC_WRITES (FSP_FLAGS_POS_PAGE_COMPRESSION_LEVEL \
+ FSP_FLAGS_WIDTH_PAGE_COMPRESSION_LEVEL)
/** Zero relative shift position of the PAGE_SSIZE field */
#define FSP_FLAGS_POS_PAGE_SSIZE (FSP_FLAGS_POS_PAGE_COMPRESSION_LEVEL \
+ FSP_FLAGS_WIDTH_PAGE_COMPRESSION_LEVEL)
#define FSP_FLAGS_POS_PAGE_SSIZE (FSP_FLAGS_POS_ATOMIC_WRITES \
+ FSP_FLAGS_WIDTH_ATOMIC_WRITES)
/** Zero relative shift position of the start of the DATA DIR bits */
#define FSP_FLAGS_POS_DATA_DIR (FSP_FLAGS_POS_PAGE_SSIZE \
+ FSP_FLAGS_WIDTH_PAGE_SSIZE)

View File

@@ -1242,8 +1242,7 @@ struct export_var_t{
decrypted */
ulint innodb_sec_rec_cluster_reads; /*!< srv_sec_rec_cluster_reads */
ulint innodb_sec_rec_cluster_reads_avoided;
/*!< srv_sec_rec_cluster_reads_avoided */
ulint innodb_sec_rec_cluster_reads_avoided; /*!< srv_sec_rec_cluster_reads_avoided */
ulint innodb_encryption_rotation_pages_read_from_cache;
ulint innodb_encryption_rotation_pages_read_from_disk;