Debian Codegraph @

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

raw
1 -- source include/have_innodb.inc
2 -- source include/have_file_key_management_plugin.inc
3 # embedded does not support restart
4 -- source include/not_embedded.inc
5
6 -- let $restart_parameters=--loose-file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys2.txt
7 -- source include/restart_mysqld.inc
8
9 create table innodb_normal(c1 bigint not null, b char(200)) engine=innodb;
10 show warnings;
11 create table innodb_compact(c1 bigint not null, b char(200)) engine=innodb row_format=compact encrypted=yes encryption_key_id=2;
12 show warnings;
13 create table innodb_compressed(c1 bigint not null, b char(200)) engine=innodb row_format=compressed encrypted=yes encryption_key_id=3;
14 show warnings;
15 create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic encrypted=yes encryption_key_id=4;
16 show warnings;
17 create table innodb_redundant(c1 bigint not null, b char(200)) engine=innodb row_format=redundant encrypted=yes encryption_key_id=5;
18 show warnings;
19
20 insert into innodb_normal values (1,'test1'),(2,'foo'),(3,'bar'),(4,'mariadb');
21 insert into innodb_compact select * from innodb_normal;
22 insert into innodb_compressed select * from innodb_normal;
23 insert into innodb_dynamic select * from innodb_normal;
24 insert into innodb_redundant select * from innodb_normal;
25
26 # Note there that these variables are updated only when real I/O is done, thus they are not reliable
27 SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted';
28 SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted';
29
30 alter table innodb_compact engine=innodb encryption_key_id = 6;
31 alter table innodb_compressed engine=innodb encryption_key_id = 6;
32 alter table innodb_dynamic engine=innodb encryption_key_id = 6;
33 alter table innodb_redundant engine=innodb encryption_key_id = 6;
34
35 select * from innodb_normal;
36 select * from innodb_compact;
37 select * from innodb_compressed;
38 select * from innodb_dynamic;
39 select * from innodb_redundant;
40
41 # Note there that these variables are updated only when real I/O is done, thus they are not reliable
42 SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted';
43 SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted';
44
45 -- let $restart_parameters=--loose-file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys3.txt
46 -- source include/restart_mysqld.inc
47
48 select * from innodb_normal;
49 select * from innodb_compact;
50 select * from innodb_compressed;
51 select * from innodb_dynamic;
52 select * from innodb_redundant;
53
54 # Note there that these variables are updated only when real I/O is done, thus they are not reliable
55 SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted';
56 SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted';
57
58 alter table innodb_compact engine=innodb encryption_key_id = 2;
59 alter table innodb_compressed engine=innodb encryption_key_id = 3;
60 alter table innodb_dynamic engine=innodb encryption_key_id = 4;
61 alter table innodb_redundant engine=innodb encryption_key_id = 5;
62
63 select * from innodb_normal;
64 select * from innodb_compact;
65 select * from innodb_compressed;
66 select * from innodb_dynamic;
67 select * from innodb_redundant;
68
69 # Note there that these variables are updated only when real I/O is done, thus they are not reliable
70 SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted';
71 SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted';
72
73 drop table innodb_normal;
74 drop table innodb_compact;
75 drop table innodb_compressed;
76 drop table innodb_dynamic;
77 drop table innodb_redundant;