Commit db02c458 authored by Marko Mäkelä's avatar Marko Mäkelä

Clean up some encryption tests

Instead of pointlessly waiting for a page flush to occur, take
the matter into our own hands and request an explicit flush.
Also, test with the minimum necessary amount of data (0 or 1 rows)
so that both page encryption and decryption will be exercised.
parent ebb39bc5
...@@ -41,6 +41,14 @@ call innodb_insert_proc(2000); ...@@ -41,6 +41,14 @@ call innodb_insert_proc(2000);
insert into innodb_compact select * from innodb_normal; insert into innodb_compact select * from innodb_normal;
insert into innodb_dynamic select * from innodb_normal; insert into innodb_dynamic select * from innodb_normal;
commit; commit;
FLUSH TABLES innodb_compact FOR EXPORT;
UNLOCK TABLES;
FLUSH TABLES innodb_dynamic FOR EXPORT;
UNLOCK TABLES;
select variable_value > 0 from information_schema.global_status
where variable_name = 'INNODB_NUM_PAGES_PAGE_COMPRESSED';
variable_value > 0
1
set global innodb_compression_algorithm = 1; set global innodb_compression_algorithm = 1;
alter table innodb_normal engine=innodb page_compressed=DEFAULT; alter table innodb_normal engine=innodb page_compressed=DEFAULT;
show create table innodb_normal; show create table innodb_normal;
...@@ -63,6 +71,16 @@ innodb_dynamic CREATE TABLE `innodb_dynamic` ( ...@@ -63,6 +71,16 @@ innodb_dynamic CREATE TABLE `innodb_dynamic` (
`c1` bigint(20) NOT NULL, `c1` bigint(20) NOT NULL,
`b` char(200) DEFAULT NULL `b` char(200) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC ) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
FLUSH TABLES innodb_normal FOR EXPORT;
UNLOCK TABLES;
FLUSH TABLES innodb_compact FOR EXPORT;
UNLOCK TABLES;
FLUSH TABLES innodb_dynamic FOR EXPORT;
UNLOCK TABLES;
select variable_value > 0 from information_schema.global_status
where variable_name = 'INNODB_NUM_PAGES_PAGE_DECOMPRESSED';
variable_value > 0
1
drop procedure innodb_insert_proc; drop procedure innodb_insert_proc;
drop table innodb_normal; drop table innodb_normal;
drop table innodb_compact; drop table innodb_compact;
......
...@@ -37,40 +37,43 @@ innodb_redundant CREATE TABLE `innodb_redundant` ( ...@@ -37,40 +37,43 @@ innodb_redundant CREATE TABLE `innodb_redundant` (
`c1` bigint(20) NOT NULL, `c1` bigint(20) NOT NULL,
`b` char(200) DEFAULT NULL `b` char(200) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT `encrypted`=yes `encryption_key_id`=4 ) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT `encrypted`=yes `encryption_key_id`=4
create procedure innodb_insert_proc (repeat_count int) FLUSH TABLES innodb_normal FOR EXPORT;
begin UNLOCK TABLES;
declare current_num int; FLUSH TABLES innodb_compact FOR EXPORT;
set current_num = 0; UNLOCK TABLES;
while current_num < repeat_count do FLUSH TABLES innodb_compressed FOR EXPORT;
insert into innodb_normal values(current_num, substring(MD5(RAND()), -64)); UNLOCK TABLES;
set current_num = current_num + 1; FLUSH TABLES innodb_dynamic FOR EXPORT;
end while; UNLOCK TABLES;
end// FLUSH TABLES innodb_redundant FOR EXPORT;
commit; UNLOCK TABLES;
begin; select variable_value > 0 from information_schema.global_status
call innodb_insert_proc(2000); where variable_name = 'INNODB_NUM_PAGES_ENCRYPTED';
insert into innodb_compact select * from innodb_normal;
insert into innodb_compressed select * from innodb_normal;
insert into innodb_dynamic select * from innodb_normal;
insert into innodb_redundant select * from innodb_normal;
commit;
SELECT variable_value > 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted';
variable_value > 0
1
SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted';
variable_value >= 0
1
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 variable_value > 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted';
variable_value > 0
1
SELECT variable_value > 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted';
variable_value > 0 variable_value > 0
1 1
BEGIN;
INSERT INTO innodb_normal SET c1 = 1;
INSERT INTO innodb_compact SET c1 = 1;
INSERT INTO innodb_compressed SET c1 = 1;
INSERT INTO innodb_dynamic SET c1 = 1;
INSERT INTO innodb_redundant SET c1 = 1;
COMMIT;
FLUSH TABLES innodb_normal FOR EXPORT;
UNLOCK TABLES;
FLUSH TABLES innodb_compact FOR EXPORT;
UNLOCK TABLES;
FLUSH TABLES innodb_compressed FOR EXPORT;
UNLOCK TABLES;
FLUSH TABLES innodb_dynamic FOR EXPORT;
UNLOCK TABLES;
FLUSH TABLES innodb_redundant FOR EXPORT;
UNLOCK TABLES;
select variable_name from information_schema.global_status
where variable_value > 0 and variable_name
IN ('INNODB_NUM_PAGES_ENCRYPTED','INNODB_NUM_PAGES_DECRYPTED');
variable_name
INNODB_NUM_PAGES_ENCRYPTED
INNODB_NUM_PAGES_DECRYPTED
SET GLOBAL innodb_encrypt_tables=OFF; SET GLOBAL innodb_encrypt_tables=OFF;
alter table innodb_compact engine=innodb encrypted=DEFAULT encryption_key_id=DEFAULT; alter table innodb_compact engine=innodb encrypted=DEFAULT encryption_key_id=DEFAULT;
show create table innodb_compact; show create table innodb_compact;
...@@ -100,13 +103,16 @@ innodb_redundant CREATE TABLE `innodb_redundant` ( ...@@ -100,13 +103,16 @@ innodb_redundant CREATE TABLE `innodb_redundant` (
`c1` bigint(20) NOT NULL, `c1` bigint(20) NOT NULL,
`b` char(200) DEFAULT NULL `b` char(200) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT ) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT
SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted'; FLUSH TABLES innodb_normal FOR EXPORT;
variable_value >= 0 UNLOCK TABLES;
1 FLUSH TABLES innodb_compact FOR EXPORT;
SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted'; UNLOCK TABLES;
variable_value >= 0 FLUSH TABLES innodb_compressed FOR EXPORT;
1 UNLOCK TABLES;
drop procedure innodb_insert_proc; FLUSH TABLES innodb_dynamic FOR EXPORT;
UNLOCK TABLES;
FLUSH TABLES innodb_redundant FOR EXPORT;
UNLOCK TABLES;
drop table innodb_normal; drop table innodb_normal;
drop table innodb_compact; drop table innodb_compact;
drop table innodb_compressed; drop table innodb_compressed;
......
...@@ -37,8 +37,10 @@ insert into innodb_compact select * from innodb_normal; ...@@ -37,8 +37,10 @@ insert into innodb_compact select * from innodb_normal;
insert into innodb_dynamic select * from innodb_normal; insert into innodb_dynamic select * from innodb_normal;
commit; commit;
let $wait_condition= select variable_value > 0 from information_schema.global_status where variable_name = 'INNODB_NUM_PAGES_PAGE_COMPRESSED'; FLUSH TABLES innodb_compact FOR EXPORT; UNLOCK TABLES;
--source include/wait_condition.inc FLUSH TABLES innodb_dynamic FOR EXPORT; UNLOCK TABLES;
select variable_value > 0 from information_schema.global_status
where variable_name = 'INNODB_NUM_PAGES_PAGE_COMPRESSED';
--let $restart_parameters=--innodb-encrypt-tables=OFF --let $restart_parameters=--innodb-encrypt-tables=OFF
--source include/restart_mysqld.inc --source include/restart_mysqld.inc
...@@ -52,8 +54,13 @@ alter table innodb_compact engine=innodb encrypted=DEFAULT encryption_key_id=DEF ...@@ -52,8 +54,13 @@ alter table innodb_compact engine=innodb encrypted=DEFAULT encryption_key_id=DEF
show create table innodb_compact; show create table innodb_compact;
alter table innodb_dynamic engine=innodb encrypted=DEFAULT encryption_key_id=DEFAULT page_compressed=DEFAULT; alter table innodb_dynamic engine=innodb encrypted=DEFAULT encryption_key_id=DEFAULT page_compressed=DEFAULT;
show create table innodb_dynamic; show create table innodb_dynamic;
let $wait_condition= select variable_value > 0 from information_schema.global_status where variable_name = 'INNODB_NUM_PAGES_PAGE_DECOMPRESSED';
--source include/wait_condition.inc FLUSH TABLES innodb_normal FOR EXPORT; UNLOCK TABLES;
FLUSH TABLES innodb_compact FOR EXPORT; UNLOCK TABLES;
FLUSH TABLES innodb_dynamic FOR EXPORT; UNLOCK TABLES;
select variable_value > 0 from information_schema.global_status
where variable_name = 'INNODB_NUM_PAGES_PAGE_DECOMPRESSED';
drop procedure innodb_insert_proc; drop procedure innodb_insert_proc;
drop table innodb_normal; drop table innodb_normal;
......
...@@ -18,47 +18,34 @@ show create table innodb_compressed; ...@@ -18,47 +18,34 @@ show create table innodb_compressed;
show create table innodb_dynamic; show create table innodb_dynamic;
show create table innodb_redundant; show create table innodb_redundant;
delimiter //; FLUSH TABLES innodb_normal FOR EXPORT; UNLOCK TABLES;
create procedure innodb_insert_proc (repeat_count int) FLUSH TABLES innodb_compact FOR EXPORT; UNLOCK TABLES;
begin FLUSH TABLES innodb_compressed FOR EXPORT; UNLOCK TABLES;
declare current_num int; FLUSH TABLES innodb_dynamic FOR EXPORT; UNLOCK TABLES;
set current_num = 0; FLUSH TABLES innodb_redundant FOR EXPORT; UNLOCK TABLES;
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;
begin; select variable_value > 0 from information_schema.global_status
call innodb_insert_proc(2000); where variable_name = 'INNODB_NUM_PAGES_ENCRYPTED';
insert into innodb_compact select * from innodb_normal;
insert into innodb_compressed select * from innodb_normal;
insert into innodb_dynamic select * from innodb_normal;
insert into innodb_redundant select * from innodb_normal;
commit;
let $wait_condition= select variable_value > 0 from information_schema.global_status where variable_name = 'INNODB_NUM_PAGES_ENCRYPTED';
--source include/wait_condition.inc
# Note there that these variables are updated only when real I/O is done, thus they are not reliable
SELECT variable_value > 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted';
SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted';
--source include/restart_mysqld.inc --source include/restart_mysqld.inc
update innodb_normal set c1 = c1 +1; BEGIN;
update innodb_compact set c1 = c1 + 1; INSERT INTO innodb_normal SET c1 = 1;
update innodb_compressed set c1 = c1 + 1; INSERT INTO innodb_compact SET c1 = 1;
update innodb_dynamic set c1 = c1 + 1; INSERT INTO innodb_compressed SET c1 = 1;
update innodb_redundant set c1 = c1 + 1; INSERT INTO innodb_dynamic SET c1 = 1;
INSERT INTO innodb_redundant SET c1 = 1;
COMMIT;
let $wait_condition= select variable_value > 0 from information_schema.global_status where variable_name = 'INNODB_NUM_PAGES_ENCRYPTED'; FLUSH TABLES innodb_normal FOR EXPORT; UNLOCK TABLES;
--source include/wait_condition.inc FLUSH TABLES innodb_compact FOR EXPORT; UNLOCK TABLES;
FLUSH TABLES innodb_compressed FOR EXPORT; UNLOCK TABLES;
FLUSH TABLES innodb_dynamic FOR EXPORT; UNLOCK TABLES;
FLUSH TABLES innodb_redundant FOR EXPORT; UNLOCK TABLES;
SELECT variable_value > 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted'; select variable_name from information_schema.global_status
SELECT variable_value > 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted'; where variable_value > 0 and variable_name
IN ('INNODB_NUM_PAGES_ENCRYPTED','INNODB_NUM_PAGES_DECRYPTED');
SET GLOBAL innodb_encrypt_tables=OFF; SET GLOBAL innodb_encrypt_tables=OFF;
alter table innodb_compact engine=innodb encrypted=DEFAULT encryption_key_id=DEFAULT; alter table innodb_compact engine=innodb encrypted=DEFAULT encryption_key_id=DEFAULT;
...@@ -70,13 +57,12 @@ show create table innodb_dynamic; ...@@ -70,13 +57,12 @@ show create table innodb_dynamic;
alter table innodb_redundant engine=innodb encrypted=DEFAULT encryption_key_id=DEFAULT; alter table innodb_redundant engine=innodb encrypted=DEFAULT encryption_key_id=DEFAULT;
show create table innodb_redundant; show create table innodb_redundant;
let $wait_condition= select variable_value > 0 from information_schema.global_status where variable_name = 'INNODB_NUM_PAGES_DECRYPTED'; FLUSH TABLES innodb_normal FOR EXPORT; UNLOCK TABLES;
--source include/wait_condition.inc FLUSH TABLES innodb_compact FOR EXPORT; UNLOCK TABLES;
FLUSH TABLES innodb_compressed FOR EXPORT; UNLOCK TABLES;
SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted'; FLUSH TABLES innodb_dynamic FOR EXPORT; UNLOCK TABLES;
SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted'; FLUSH TABLES innodb_redundant FOR EXPORT; UNLOCK TABLES;
drop procedure innodb_insert_proc;
drop table innodb_normal; drop table innodb_normal;
drop table innodb_compact; drop table innodb_compact;
drop table innodb_compressed; drop table innodb_compressed;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment