1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Write proper tests for MDEV-12634: Uninitialised ROW_MERGE_RESERVE_SIZE bytes

Introduce innodb_encrypt_log.combinations and prove that
the encryption and decryption take place during both
online ADD INDEX (WL#5266) and online table-rebuilding ALTER (WL#6625).
This commit is contained in:
Marko Mäkelä
2017-09-16 16:55:16 +03:00
parent f24d36ae1e
commit 836d4e74d9
15 changed files with 365 additions and 160 deletions

View File

@ -1,30 +0,0 @@
SET GLOBAL innodb_file_format = `Barracuda`;
create table t1(id int not null primary key auto_increment, credit_card varchar(200), private varchar(50)) engine=innodb;
SET SESSION debug_dbug="+d,ib_merge_wait_after_read";
alter table t1 add index secret (credit_card), ALGORITHM=INPLACE, LOCK=NONE;
SET GLOBAL innodb_encryption_rotate_key_age = 1;
create table t2(id int) engine=innodb;
SET SESSION debug_dbug="+d,ib_merge_wait_after_read";
alter table t1 add index secret2 (private), ALGORITHM=INPLACE, LOCK=NONE;
insert into t1(credit_card) select credit_card from t1;
insert into t1(credit_card) select credit_card from t1;
insert into t1(credit_card) select credit_card from t1;
drop table t2;
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_encryption_n_merge_blocks_encrypted';
variable_value > 0
1
SELECT variable_value > 0 FROM information_schema.global_status WHERE variable_name = 'innodb_encryption_n_merge_blocks_decrypted';
variable_value > 0
1
SELECT variable_value > 0 FROM information_schema.global_status WHERE variable_name = 'innodb_encryption_n_rowlog_blocks_encrypted';
variable_value > 0
1
SELECT variable_value > 0 FROM information_schema.global_status WHERE variable_name = 'innodb_encryption_n_rowlog_blocks_decrypted';
variable_value > 0
1
drop table t1;
SET GLOBAL innodb_file_format=Antelope;
SET GLOBAL innodb_encryption_rotate_key_age=15;

View File

@ -1,7 +0,0 @@
--aria-encrypt-tables
--encrypt-tmp-disk-tables
--innodb-encrypt-tables
--innodb-encrypt-log
--innodb-encryption-rotate-key-age=15
--innodb-encryption-threads=4
--innodb-tablespaces-encryption

View File

@ -1,90 +0,0 @@
-- source include/have_innodb.inc
-- source include/have_example_key_management_plugin.inc
# needs dbug_dbug
-- source include/have_debug.inc
--disable_warnings
--disable_query_log
let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
let $key_age = `SELECT @@innodb_encryption_rotate_key_age`;
--enable_query_log
SET GLOBAL innodb_file_format = `Barracuda`;
--enable_warnings
let $MYSQLD_DATADIR = `SELECT @@datadir`;
let $MYSQLD_TMPDIR = `SELECT @@tmpdir`;
#
# Create a table that will be encrypted and put some sensitive data to it (credit card numbers)
#
create table t1(id int not null primary key auto_increment, credit_card varchar(200), private varchar(50)) engine=innodb;
let $rows = 15000;
--disable_query_log
begin;
while ($rows)
{
eval insert into t1 values(NULL, '0000-0000-0000-0000','private_data');
dec $rows;
}
commit;
--enable_query_log
--let $wait_timeout= 600
--let $wait_condition=SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0
--source include/wait_condition.inc
#
# Now we create secondary index for credit_card column in parallel we create new rows
# forcing alter table to wait so that row log is used.
#
SET SESSION debug_dbug="+d,ib_merge_wait_after_read";
send alter table t1 add index secret (credit_card), ALGORITHM=INPLACE, LOCK=NONE;
#
# Force key rotation and create second index for same table
#
connect (con2,localhost,root,,);
SET GLOBAL innodb_encryption_rotate_key_age = 1;
create table t2(id int) engine=innodb;
SET SESSION debug_dbug="+d,ib_merge_wait_after_read";
send alter table t1 add index secret2 (private), ALGORITHM=INPLACE, LOCK=NONE;
#
# Create new rows to row log
#
connect (con1,localhost,root,,);
insert into t1(credit_card) select credit_card from t1;
insert into t1(credit_card) select credit_card from t1;
insert into t1(credit_card) select credit_card from t1;
connection default;
reap;
disconnect con1;
connection con2;
reap;
drop table t2;
connection default;
disconnect con2;
let $wait_condition= select variable_value > 0 from information_schema.global_status where variable_name = 'INNODB_NUM_PAGES_ENCRYPTED';
--source include/wait_condition.inc
#
# Verify that both merge blocks and row log blocks are encryted and decrypted
#
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_encryption_n_merge_blocks_encrypted';
SELECT variable_value > 0 FROM information_schema.global_status WHERE variable_name = 'innodb_encryption_n_merge_blocks_decrypted';
SELECT variable_value > 0 FROM information_schema.global_status WHERE variable_name = 'innodb_encryption_n_rowlog_blocks_encrypted';
SELECT variable_value > 0 FROM information_schema.global_status WHERE variable_name = 'innodb_encryption_n_rowlog_blocks_decrypted';
drop table t1;
--disable_warnings
eval SET GLOBAL innodb_file_format=$innodb_file_format_orig;
eval SET GLOBAL innodb_encryption_rotate_key_age=$key_age;
--enable_warnings