1-- source include/have_innodb.inc 2-- source include/have_example_key_management_plugin.inc 3-- source include/not_embedded.inc 4 5let $innodb_encrypt_tables_orig = `SELECT @@innodb_encrypt_tables`; 6let $innodb_encryption_threads_orig = `SELECT @@innodb_encryption_threads`; 7 8SET GLOBAL innodb_encryption_threads = 4; 9 10# zlib 11set global innodb_compression_algorithm = 1; 12 13create table innodb_normal (c1 int, b char(20)) engine=innodb; 14show warnings; 15create table innodb_page_compressed1 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=1; 16show warnings; 17show create table innodb_page_compressed1; 18create table innodb_page_compressed2 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=2; 19show warnings; 20show create table innodb_page_compressed2; 21create table innodb_page_compressed3 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=3; 22show warnings; 23show create table innodb_page_compressed3; 24create table innodb_page_compressed4 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=4; 25show warnings; 26show create table innodb_page_compressed4; 27create table innodb_page_compressed5 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=5; 28show warnings; 29show create table innodb_page_compressed5; 30create table innodb_page_compressed6 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=6; 31show warnings; 32show create table innodb_page_compressed6; 33create table innodb_page_compressed7 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=7; 34show warnings; 35show create table innodb_page_compressed7; 36create table innodb_page_compressed8 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=8; 37show warnings; 38show create table innodb_page_compressed8; 39create table innodb_page_compressed9 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=9; 40show warnings; 41show create table innodb_page_compressed9; 42delimiter //; 43create procedure innodb_insert_proc (repeat_count int) 44begin 45 declare current_num int; 46 set current_num = 0; 47 while current_num < repeat_count do 48 insert into innodb_normal values(current_num,'testing..'); 49 set current_num = current_num + 1; 50 end while; 51end// 52delimiter ;// 53commit; 54 55begin; 56call innodb_insert_proc(2000); 57insert into innodb_page_compressed1 select * from innodb_normal; 58insert into innodb_page_compressed2 select * from innodb_normal; 59insert into innodb_page_compressed3 select * from innodb_normal; 60insert into innodb_page_compressed4 select * from innodb_normal; 61insert into innodb_page_compressed5 select * from innodb_normal; 62insert into innodb_page_compressed6 select * from innodb_normal; 63insert into innodb_page_compressed7 select * from innodb_normal; 64insert into innodb_page_compressed8 select * from innodb_normal; 65insert into innodb_page_compressed9 select * from innodb_normal; 66commit; 67 68select count(*) from innodb_page_compressed1 where c1 < 500000; 69select count(*) from innodb_page_compressed2 where c1 < 500000; 70select count(*) from innodb_page_compressed3 where c1 < 500000; 71select count(*) from innodb_page_compressed4 where c1 < 500000; 72select count(*) from innodb_page_compressed5 where c1 < 500000; 73select count(*) from innodb_page_compressed6 where c1 < 500000; 74select count(*) from innodb_page_compressed7 where c1 < 500000; 75select count(*) from innodb_page_compressed8 where c1 < 500000; 76select count(*) from innodb_page_compressed9 where c1 < 500000; 77 78flush tables innodb_page_compressed1, innodb_page_compressed2, 79innodb_page_compressed3, innodb_page_compressed4, 80innodb_page_compressed5, innodb_page_compressed6, 81innodb_page_compressed7, innodb_page_compressed8, 82innodb_page_compressed9 for export; 83 84unlock tables; 85 86--echo # Wait until dirty pages are compressed and encrypted 87let $wait_condition= select variable_value > 0 from information_schema.global_status where variable_name = 'INNODB_NUM_PAGES_PAGE_COMPRESSED'; 88--source include/wait_condition.inc 89let $wait_condition= select variable_value > 0 from information_schema.global_status where variable_name = 'INNODB_NUM_PAGES_ENCRYPTED'; 90--source include/wait_condition.inc 91 92SELECT variable_value > 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted'; 93SELECT variable_value > 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_page_compressed'; 94 95--source include/restart_mysqld.inc 96 97SET GLOBAL innodb_encryption_threads = 4; 98SET GLOBAL innodb_encrypt_tables = off; 99 100update innodb_page_compressed1 set c1 = c1 + 1; 101update innodb_page_compressed2 set c1 = c1 + 1; 102update innodb_page_compressed3 set c1 = c1 + 1; 103update innodb_page_compressed4 set c1 = c1 + 1; 104update innodb_page_compressed5 set c1 = c1 + 1; 105update innodb_page_compressed6 set c1 = c1 + 1; 106update innodb_page_compressed7 set c1 = c1 + 1; 107update innodb_page_compressed8 set c1 = c1 + 1; 108update innodb_page_compressed9 set c1 = c1 + 1; 109 110flush tables innodb_page_compressed1, innodb_page_compressed2, 111innodb_page_compressed3, innodb_page_compressed4, 112innodb_page_compressed5, innodb_page_compressed6, 113innodb_page_compressed7, innodb_page_compressed8, 114innodb_page_compressed9 for export; 115 116unlock tables; 117 118--echo # Wait until dirty pages are compressed and encrypted 2 119let $wait_condition= select variable_value > 0 from information_schema.global_status where variable_name = 'INNODB_NUM_PAGES_PAGE_COMPRESSED'; 120--source include/wait_condition.inc 121let $wait_condition= select variable_value > 0 from information_schema.global_status where variable_name = 'INNODB_NUM_PAGES_DECRYPTED'; 122--source include/wait_condition.inc 123 124SELECT variable_value > 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted'; 125SELECT variable_value > 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_page_compressed'; 126SELECT variable_value > 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_page_decompressed'; 127 128drop procedure innodb_insert_proc; 129drop table innodb_normal; 130drop table innodb_page_compressed1; 131drop table innodb_page_compressed2; 132drop table innodb_page_compressed3; 133drop table innodb_page_compressed4; 134drop table innodb_page_compressed5; 135drop table innodb_page_compressed6; 136drop table innodb_page_compressed7; 137drop table innodb_page_compressed8; 138drop table innodb_page_compressed9; 139 140# reset system 141--disable_query_log 142EVAL SET GLOBAL innodb_encrypt_tables = $innodb_encrypt_tables_orig; 143EVAL SET GLOBAL innodb_encryption_threads = $innodb_encryption_threads_orig; 144--enable_query_log 145