Debian Codegraph @

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

raw
1 --source include/have_innodb.inc
2 --source include/have_example_key_management_plugin.inc
3 --source include/have_debug.inc
4 --source include/not_embedded.inc
5 --source include/innodb_undo_tablespaces.inc
6
7 SHOW VARIABLES LIKE 'innodb_encrypt%';
8
9 SET GLOBAL innodb_encrypt_tables = ON;
10
11 CREATE TABLE t1(f1 BIGINT PRIMARY KEY, f2 int not null,
12 f3 int not null, index(f1), index idx_1(f2),
13 index(f2, f3)) ENGINE=InnoDB;
14 --let $tables_count= `select count(*) + 1 + @@global.innodb_undo_tablespaces from information_schema.tables where engine = 'InnoDB'`
15
16 --echo # Wait max 10 min for key encryption threads to encrypt all spaces
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 --sorted_result
21 SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
22
23 CREATE TABLE t2 (f1 int not null)engine=innodb;
24 let $restart_parameters=--debug-dbug=d,ib_log_checkpoint_avoid;
25 --source include/restart_mysqld.inc
26
27 # Stop the purge
28 connect(con1,localhost,root,,,);
29 begin;
30 insert into t2 values(1);
31
32 connection default;
33
34 --let $tables_count= `select count(*) + 1 + @@global.innodb_undo_tablespaces from information_schema.tables where engine = 'InnoDB'`
35 set global innodb_encrypt_tables = OFF;
36
37 --echo # Wait max 10 min for key encryption threads to decrypt all spaces
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 --sorted_result
42 SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
43
44 # Free the index `idx_1`
45 alter table t1 drop index idx_1;
46
47 set global innodb_encrypt_tables = ON;
48
49 --echo # Wait max 10 min for key encryption threads to encrypt all spaces
50 --let $wait_timeout= 600
51 --let $wait_condition=SELECT COUNT(*) >= $tables_count FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
52 --source include/wait_condition.inc
53 --sorted_result
54 SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
55
56 disconnect con1;
57 let $shutdown_timeout=0;
58 --source include/restart_mysqld.inc
59
60 drop table t1, t2;
61
62 #
63 #
64 CREATE TABLE t1(f1 BIGINT PRIMARY KEY, f2 int not null,
65 f3 int not null, index(f1), index idx_1(f2),
66 index(f2, f3)) ENGINE=InnoDB;
67 --let $tables_count= `select count(*) + 1 + @@global.innodb_undo_tablespaces from information_schema.tables where engine = 'InnoDB'`
68
69 --echo # Wait max 10 min for key encryption threads to encrypt all spaces
70 --let $wait_timeout= 600
71 --let $wait_condition=SELECT COUNT(*) >= $tables_count FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
72 --source include/wait_condition.inc
73 --sorted_result
74 SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
75
76 CREATE TABLE t2 (f1 int not null)engine=innodb;
77 --source include/restart_mysqld.inc
78
79 # Stop the purge
80 connect(con1,localhost,root,,,);
81 begin;
82 insert into t2 values(1);
83
84 connection default;
85
86 --let $tables_count= `select count(*) + 1 + @@global.innodb_undo_tablespaces from information_schema.tables where engine = 'InnoDB'`
87 set global innodb_encrypt_tables = OFF;
88
89 --echo # Wait max 10 min for key encryption threads to decrypt all spaces
90 --let $wait_timeout= 600
91 --let $wait_condition=SELECT COUNT(*) >= $tables_count FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
92 --source include/wait_condition.inc
93 --sorted_result
94 SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
95
96 # Free the index `idx_1`
97 alter table t1 drop index idx_1;
98
99 disconnect con1;
100 --source include/restart_mysqld.inc
101
102 # Stop the purge
103 connect(con1,localhost,root,,,);
104 begin;
105 insert into t2 values(1);
106
107 connection default;
108 set global innodb_encrypt_tables = ON;
109
110 --echo # Wait max 10 min for key encryption threads to encrypt all spaces
111 --let $wait_timeout= 600
112 --let $wait_condition=SELECT COUNT(*) >= $tables_count FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
113 --source include/wait_condition.inc
114 --sorted_result
115 SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
116
117 disconnect con1;
118 drop table t2, t1;