Debian Codegraph @

mysql-test/suite/encryption/t/key_version_rotation.test

raw
1 --source include/have_innodb.inc
2 --source include/have_debug.inc
3 --source include/have_sequence.inc
4
5 create table t1(f1 int not null)engine=innodb;
6 create table t2(f1 int not null)engine=innodb;
7 insert into t1 select * from seq_1_to_100;
8 insert into t2 select * from seq_1_to_100;
9
10 let $restart_parameters=--innodb_encrypt_tables=0 --innodb_encryption_threads=1 --innodb_encryption_rotate_key_age=9;
11 --source include/restart_mysqld.inc
12
13 --echo # Enable encryption
14
15 set global innodb_encrypt_tables=ON;
16 --let $tables_count= `select count(*) from information_schema.tables where engine = 'InnoDB'`
17 --let $wait_timeout= 600
18 --let $wait_condition=SELECT COUNT(*) >= $tables_count FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
19 --source include/wait_condition.inc
20 --echo # Create a new table and it is added to rotation list
21 create table t3(f1 int not null)engine=innodb;
22 insert into t3 select * from seq_1_to_100;
23
24 --echo # Increase the version and it should set rotation
25 --echo # variable for the encryption plugin
26
27 set global debug_key_management_version=10;
28 select @@debug_key_management_version;
29 --let $tables_count= `select count(*) from information_schema.tables where engine = 'InnoDB'`
30 --let $wait_timeout= 600
31 --let $wait_condition=SELECT COUNT(*) >= $tables_count FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
32 --source include/wait_condition.inc
33
34 --echo # Decrease the key version and Disable the encryption
35 set global debug_key_management_version=1;
36 set global innodb_encrypt_tables=off;
37
38 --let $wait_timeout= 600
39 --let $wait_condition=SELECT COUNT(*) >= $tables_count FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
40 --source include/wait_condition.inc
41 DROP TABLE t1, t2, t3;