Commit faad7e0c authored by Jan Lindström's avatar Jan Lindström Committed by Sergei Golubchik

Add test case for combination Google encryption and page compressed tables.

parent 21430e43
--aria-encrypt-tables=ON
--encryption-algorithm=aes_ctr
--encrypt-tmp-disk-tables=ON
--innodb-encrypt-tables=ON
--innodb-encryption-rotate-key-age=15
--innodb-encryption-threads=4
--innodb-tablespaces-encryption
-- source include/have_innodb.inc
-- source include/have_example_key_management_plugin.inc
# embedded does not support restart
-- source include/not_embedded.inc
--disable_query_log
let $innodb_compression_algorithm_orig=`SELECT @@innodb_compression_algorithm`;
let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
--enable_query_log
SET GLOBAL innodb_file_format = `Barracuda`;
SET GLOBAL innodb_file_per_table = ON;
# zlib
set global innodb_compression_algorithm = 1;
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_compressed=1;
create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic page_compressed=1;
show warnings;
show create table innodb_normal;
show create table innodb_compact;
show create table innodb_dynamic;
delimiter //;
create procedure innodb_insert_proc (repeat_count int)
begin
declare current_num int;
set current_num = 0;
while current_num < repeat_count do
insert into innodb_normal values(current_num, substring(MD5(RAND()), -64));
set current_num = current_num + 1;
end while;
end//
delimiter ;//
commit;
set autocommit=0;
call innodb_insert_proc(5000);
commit;
set autocommit=1;
insert into innodb_compact select * from innodb_normal;
insert into innodb_dynamic select * from innodb_normal;
update innodb_normal set c1 = c1 + 1;
update innodb_compact set c1 = c1 + 1;
update innodb_dynamic set c1 = c1 + 1;
select count(*) from innodb_normal;
select count(*) from innodb_compact where c1 < 1500000;
select count(*) from innodb_dynamic where c1 < 1500000;
SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_encrypted';
SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_decrypted';
SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_encryption_error';
SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_compressed';
SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_decompressed';
--source include/restart_mysqld.inc
SET GLOBAL innodb_file_format = `Barracuda`;
SET GLOBAL innodb_file_per_table = ON;
# zlib
set global innodb_compression_algorithm = 1;
update innodb_normal set c1 = c1 + 1;
update innodb_compact set c1 = c1 + 1;
update innodb_dynamic set c1 = c1 + 1;
select count(*) from innodb_normal;
select count(*) from innodb_compact where c1 < 1500000;
select count(*) from innodb_dynamic where c1 < 1500000;
SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_encrypted';
SELECT variable_value >= 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_decrypted';
SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_encryption_error';
SELECT variable_value > 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_compressed';
SELECT variable_value > 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_decompressed';
alter table innodb_normal engine=innodb page_compressed=DEFAULT;
show create table innodb_normal;
alter table innodb_compact engine=innodb page_compressed=DEFAULT;
show create table innodb_compact;
alter table innodb_dynamic engine=innodb page_compressed=DEFAULT;
show create table innodb_dynamic;
--source include/restart_mysqld.inc
SET GLOBAL innodb_file_format = `Barracuda`;
SET GLOBAL innodb_file_per_table = ON;
show create table innodb_normal;
show create table innodb_compact;
show create table innodb_dynamic;
update innodb_normal set c1 = c1 + 1;
update innodb_compact set c1 = c1 + 1;
update innodb_dynamic set c1 = c1 + 1;
select count(*) from innodb_normal;
select count(*) from innodb_compact where c1 < 1500000;
select count(*) from innodb_dynamic where c1 < 1500000;
SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_encrypted';
SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_decrypted';
SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_encryption_error';
SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_compressed';
SELECT variable_value = 0 FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_num_pages_page_decompressed';
drop procedure innodb_insert_proc;
drop table innodb_normal;
drop table innodb_compact;
drop table innodb_dynamic;
# reset system
--disable_query_log
EVAL SET GLOBAL innodb_compression_algorithm = $innodb_compression_algorithm_orig;
EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig;
EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig;
--enable_query_log
...@@ -843,6 +843,9 @@ buf_dblwr_write_block_to_datafile( ...@@ -843,6 +843,9 @@ buf_dblwr_write_block_to_datafile(
ut_a(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE); ut_a(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE);
buf_dblwr_check_page_lsn(block->frame); buf_dblwr_check_page_lsn(block->frame);
fprintf(stderr, "JAN: space %lu page_type %lu\n", buf_block_get_space(block),
mach_read_from_2((byte *)frame+FIL_PAGE_TYPE));
fil_io(flags, sync, buf_block_get_space(block), 0, fil_io(flags, sync, buf_block_get_space(block), 0,
buf_block_get_page_no(block), 0, UNIV_PAGE_SIZE, buf_block_get_page_no(block), 0, UNIV_PAGE_SIZE,
frame, (void*) block, (ulint *)&bpage->write_size, bpage->newest_modification ); frame, (void*) block, (ulint *)&bpage->write_size, bpage->newest_modification );
......
...@@ -281,14 +281,20 @@ fil_compress_page( ...@@ -281,14 +281,20 @@ fil_compress_page(
/* read original page type */ /* read original page type */
orig_page_type = mach_read_from_2(buf + FIL_PAGE_TYPE); orig_page_type = mach_read_from_2(buf + FIL_PAGE_TYPE);
ut_ad(orig_page_type != 0);
/* Let's not compress file space header or /* Let's not compress file space header or
extent descriptor */ extent descriptor */
if ((orig_page_type == FIL_PAGE_TYPE_FSP_HDR) if (orig_page_type == FIL_PAGE_TYPE_FSP_HDR ||
|| (orig_page_type == FIL_PAGE_TYPE_XDES) ) { orig_page_type == FIL_PAGE_TYPE_XDES ||
orig_page_type == FIL_PAGE_PAGE_COMPRESSED ||
orig_page_type == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED) {
*out_len = len; *out_len = len;
return (buf); return (buf);
} }
fprintf(stderr, "JAN: orig_page_type %lu\n", orig_page_type);
level = compression_level; level = compression_level;
ut_ad(fil_space_is_page_compressed(space_id)); ut_ad(fil_space_is_page_compressed(space_id));
......
...@@ -670,10 +670,9 @@ fil_space_encrypt(ulint space, ulint offset, lsn_t lsn, ...@@ -670,10 +670,9 @@ fil_space_encrypt(ulint space, ulint offset, lsn_t lsn,
ibool page_compressed = (mach_read_from_2(src_frame+FIL_PAGE_TYPE) == FIL_PAGE_PAGE_COMPRESSED); ibool page_compressed = (mach_read_from_2(src_frame+FIL_PAGE_TYPE) == FIL_PAGE_PAGE_COMPRESSED);
ibool page_encrypted = fil_space_is_page_encrypted(space); ibool page_encrypted = fil_space_is_page_encrypted(space);
ulint compression_alg = mach_read_from_8(src_frame+FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION); ulint compression_alg = mach_read_from_8(src_frame+FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION);
ulint orig_page_type = mach_read_from_2(src_frame+FIL_PAGE_TYPE); ulint orig_page_type = mach_read_from_2(src_frame+FIL_PAGE_TYPE);
if (orig_page_type==FIL_PAGE_TYPE_FSP_HDR if (orig_page_type==FIL_PAGE_TYPE_FSP_HDR
|| orig_page_type==FIL_PAGE_TYPE_XDES || orig_page_type==FIL_PAGE_TYPE_XDES
|| orig_page_type== FIL_PAGE_PAGE_ENCRYPTED || orig_page_type== FIL_PAGE_PAGE_ENCRYPTED
......
...@@ -283,12 +283,16 @@ fil_compress_page( ...@@ -283,12 +283,16 @@ fil_compress_page(
/* Let's not compress file space header or /* Let's not compress file space header or
extent descriptor */ extent descriptor */
if ((orig_page_type == FIL_PAGE_TYPE_FSP_HDR) if (orig_page_type == FIL_PAGE_TYPE_FSP_HDR ||
|| (orig_page_type == FIL_PAGE_TYPE_XDES) ) { orig_page_type == FIL_PAGE_TYPE_XDES ||
orig_page_type == FIL_PAGE_PAGE_COMPRESSED ||
orig_page_type == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED) {
*out_len = len; *out_len = len;
return (buf); return (buf);
} }
fprintf(stderr, "JAN: orig_page_type %lu\n", orig_page_type);
level = compression_level; level = compression_level;
ut_ad(fil_space_is_page_compressed(space_id)); ut_ad(fil_space_is_page_compressed(space_id));
......
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