Skip to content

Commit bb29712

Browse files
MDEV-30119 INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION.NAME is NULL for undo tablespaces
- Information_schema.innodb_tablespaces_encryption should print undo tablespace name as innodb_undo001, innodb_undo002 and soon. - Encryption test should include undo tablespaces count when the tests are waiting for the condition to check whether all tables are encrypted or decrypted.
1 parent c1de377 commit bb29712

11 files changed

+206
-13
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
--- encrypt_and_grep.result 2022-09-02 22:36:21.669650278 +0530
2+
+++ encrypt_and_grep.reject 2022-11-29 19:01:22.080027528 +0530
3+
@@ -14,6 +14,9 @@
4+
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
5+
NAME
6+
innodb_system
7+
+innodb_undo001
8+
+innodb_undo002
9+
+innodb_undo003
10+
mysql/innodb_index_stats
11+
mysql/innodb_table_stats
12+
mysql/transaction_registry
13+
@@ -35,6 +38,9 @@
14+
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
15+
NAME
16+
innodb_system
17+
+innodb_undo001
18+
+innodb_undo002
19+
+innodb_undo003
20+
mysql/innodb_index_stats
21+
mysql/innodb_table_stats
22+
mysql/transaction_registry
23+
@@ -62,6 +68,9 @@
24+
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
25+
NAME
26+
innodb_system
27+
+innodb_undo001
28+
+innodb_undo002
29+
+innodb_undo003
30+
mysql/innodb_index_stats
31+
mysql/innodb_table_stats
32+
mysql/transaction_registry
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
--- innodb-remove-encryption.result 2022-09-02 20:44:59.960430396 +0530
2+
+++ innodb-remove-encryption,undo3.reject 2022-11-29 19:02:24.813094277 +0530
3+
@@ -13,6 +13,9 @@
4+
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
5+
NAME
6+
innodb_system
7+
+innodb_undo001
8+
+innodb_undo002
9+
+innodb_undo003
10+
mysql/innodb_index_stats
11+
mysql/innodb_table_stats
12+
mysql/transaction_registry
13+
@@ -24,6 +27,9 @@
14+
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
15+
NAME
16+
innodb_system
17+
+innodb_undo001
18+
+innodb_undo002
19+
+innodb_undo003
20+
mysql/innodb_index_stats
21+
mysql/innodb_table_stats
22+
mysql/transaction_registry
23+
@@ -36,6 +42,9 @@
24+
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
25+
NAME
26+
innodb_system
27+
+innodb_undo001
28+
+innodb_undo002
29+
+innodb_undo003
30+
mysql/innodb_index_stats
31+
mysql/innodb_table_stats
32+
mysql/transaction_registry
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
--- innodb_encrypt_freed.result 2021-03-23 15:44:14.466377983 +0530
2+
+++ innodb_encrypt_freed,undo3.reject 2022-11-29 19:04:24.987010571 +0530
3+
@@ -14,6 +14,9 @@
4+
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
5+
NAME
6+
innodb_system
7+
+innodb_undo001
8+
+innodb_undo002
9+
+innodb_undo003
10+
mysql/innodb_index_stats
11+
mysql/innodb_table_stats
12+
mysql/transaction_registry
13+
@@ -29,6 +32,9 @@
14+
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
15+
NAME
16+
innodb_system
17+
+innodb_undo001
18+
+innodb_undo002
19+
+innodb_undo003
20+
mysql/innodb_index_stats
21+
mysql/innodb_table_stats
22+
mysql/transaction_registry
23+
@@ -40,6 +46,9 @@
24+
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
25+
NAME
26+
innodb_system
27+
+innodb_undo001
28+
+innodb_undo002
29+
+innodb_undo003
30+
mysql/innodb_index_stats
31+
mysql/innodb_table_stats
32+
mysql/transaction_registry
33+
@@ -55,6 +64,9 @@
34+
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
35+
NAME
36+
innodb_system
37+
+innodb_undo001
38+
+innodb_undo002
39+
+innodb_undo003
40+
mysql/innodb_index_stats
41+
mysql/innodb_table_stats
42+
mysql/transaction_registry
43+
@@ -70,6 +82,9 @@
44+
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
45+
NAME
46+
innodb_system
47+
+innodb_undo001
48+
+innodb_undo002
49+
+innodb_undo003
50+
mysql/innodb_index_stats
51+
mysql/innodb_table_stats
52+
mysql/transaction_registry
53+
@@ -87,6 +102,9 @@
54+
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
55+
NAME
56+
innodb_system
57+
+innodb_undo001
58+
+innodb_undo002
59+
+innodb_undo003
60+
mysql/innodb_index_stats
61+
mysql/innodb_table_stats
62+
mysql/transaction_registry
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
--- innodb_encrypt_key_rotation_age.result 2022-06-02 16:15:08.395122720 +0530
2+
+++ innodb_encrypt_key_rotation_age,undo3.reject 2022-11-29 19:06:07.964542115 +0530
3+
@@ -12,6 +12,9 @@
4+
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
5+
NAME
6+
innodb_system
7+
+innodb_undo001
8+
+innodb_undo002
9+
+innodb_undo003
10+
mysql/innodb_index_stats
11+
mysql/innodb_table_stats
12+
mysql/transaction_registry
13+
@@ -27,6 +30,9 @@
14+
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
15+
NAME
16+
innodb_system
17+
+innodb_undo001
18+
+innodb_undo002
19+
+innodb_undo003
20+
mysql/innodb_index_stats
21+
mysql/innodb_table_stats
22+
mysql/transaction_registry
23+
@@ -39,6 +45,9 @@
24+
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
25+
NAME
26+
innodb_system
27+
+innodb_undo001
28+
+innodb_undo002
29+
+innodb_undo003
30+
mysql/innodb_index_stats
31+
mysql/innodb_table_stats
32+
mysql/transaction_registry
33+
@@ -59,6 +68,9 @@
34+
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
35+
NAME
36+
innodb_system
37+
+innodb_undo001
38+
+innodb_undo002
39+
+innodb_undo003
40+
mysql/innodb_index_stats
41+
mysql/innodb_table_stats
42+
mysql/transaction_registry
43+
@@ -71,6 +83,9 @@
44+
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
45+
NAME
46+
innodb_system
47+
+innodb_undo001
48+
+innodb_undo002
49+
+innodb_undo003
50+
mysql/innodb_index_stats
51+
mysql/innodb_table_stats
52+
mysql/transaction_registry

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
-- source include/have_innodb.inc
22
-- source include/have_debug.inc
3+
-- source include/innodb_undo_tablespaces.inc
34
-- source include/not_embedded.inc
45

56
if (`select count(*) = 0 from information_schema.plugins
@@ -13,7 +14,7 @@ create table t1(a serial) engine=innoDB;
1314
set global innodb_encrypt_tables=ON;
1415
show variables like 'innodb_encrypt%';
1516

16-
--let $tables_count= `select count(*) + 1 from information_schema.tables where engine = 'InnoDB'`
17+
--let $tables_count= `select count(*) + 1 + @@global.innodb_undo_tablespaces from information_schema.tables where engine = 'InnoDB'`
1718
let $wait_condition= select count(*) = $tables_count from information_schema.innodb_tablespaces_encryption where current_key_version=1;
1819
--source include/wait_condition.inc
1920

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
-- source include/have_innodb.inc
2+
-- source include/innodb_undo_tablespaces.inc
23
-- source include/have_file_key_management_plugin.inc
34

45
#
@@ -59,7 +60,8 @@ SET GLOBAL innodb_encrypt_tables = off;
5960

6061
--echo # Wait max 10 min for key encryption threads to decrypt all spaces
6162
--let $wait_timeout= 600
62-
--let $tables_count= `select count(*) from information_schema.tables where engine = 'InnoDB'`
63+
--let $tables_count= `select count(*) + @@global.innodb_undo_tablespaces from information_schema.tables where engine = 'InnoDB'`
64+
6365
--let $wait_condition=SELECT COUNT(*) = $tables_count FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 AND CURRENT_KEY_VERSION = 0;
6466
--source include/wait_condition.inc
6567

mysql-test/suite/encryption/t/innodb-remove-encryption.test

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# Test uses restart
33
--source include/not_embedded.inc
44
--source filekeys_plugin.inc
5+
--source include/innodb_undo_tablespaces.inc
56

67
#
78
# MDEV-15566: System tablespace does not easily key rotate to unencrypted
@@ -23,7 +24,7 @@ create table t1(a int not null primary key, b char(200)) engine=innodb;
2324

2425
--echo # Wait until encryption threads have encrypted all tablespaces
2526

26-
--let $tables_count= `select count(*) from information_schema.tables where engine = 'InnoDB'`
27+
--let $tables_count= `select count(*) + @@global.innodb_undo_tablespaces from information_schema.tables where engine = 'InnoDB'`
2728
--let $wait_timeout= 600
2829
--let $wait_condition=SELECT COUNT(*) = $tables_count FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0 AND ROTATING_OR_FLUSHING = 0;
2930
--source include/wait_condition.inc

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
--source include/have_example_key_management_plugin.inc
33
--source include/have_debug.inc
44
--source include/not_embedded.inc
5+
--source include/innodb_undo_tablespaces.inc
56

67
SHOW VARIABLES LIKE 'innodb_encrypt%';
78

@@ -10,7 +11,7 @@ SET GLOBAL innodb_encrypt_tables = ON;
1011
CREATE TABLE t1(f1 BIGINT PRIMARY KEY, f2 int not null,
1112
f3 int not null, index(f1), index idx_1(f2),
1213
index(f2, f3)) ENGINE=InnoDB;
13-
--let $tables_count= `select count(*) + 1 from information_schema.tables where engine = 'InnoDB'`
14+
--let $tables_count= `select count(*) + 1 + @@global.innodb_undo_tablespaces from information_schema.tables where engine = 'InnoDB'`
1415

1516
--echo # Wait max 10 min for key encryption threads to encrypt all spaces
1617
--let $wait_timeout= 600
@@ -30,12 +31,12 @@ insert into t2 values(1);
3031

3132
connection default;
3233

33-
--let $tables_count= `select count(*) + 1 from information_schema.tables where engine = 'InnoDB'`
34+
--let $tables_count= `select count(*) + 1 + @@global.innodb_undo_tablespaces from information_schema.tables where engine = 'InnoDB'`
3435
set global innodb_encrypt_tables = OFF;
3536

3637
--echo # Wait max 10 min for key encryption threads to decrypt all spaces
3738
--let $wait_timeout= 600
38-
--let $wait_condition=SELECT COUNT(*) >= $tables_count FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
39+
--let $wait_condition=SELECT COUNT(*) >= $tables_count FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0
3940
--source include/wait_condition.inc
4041
--sorted_result
4142
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
@@ -63,7 +64,7 @@ drop table t1, t2;
6364
CREATE TABLE t1(f1 BIGINT PRIMARY KEY, f2 int not null,
6465
f3 int not null, index(f1), index idx_1(f2),
6566
index(f2, f3)) ENGINE=InnoDB;
66-
--let $tables_count= `select count(*) + 1 from information_schema.tables where engine = 'InnoDB'`
67+
--let $tables_count= `select count(*) + 1 + @@global.innodb_undo_tablespaces from information_schema.tables where engine = 'InnoDB'`
6768

6869
--echo # Wait max 10 min for key encryption threads to encrypt all spaces
6970
--let $wait_timeout= 600
@@ -82,7 +83,7 @@ insert into t2 values(1);
8283

8384
connection default;
8485

85-
--let $tables_count= `select count(*) + 1 from information_schema.tables where engine = 'InnoDB'`
86+
--let $tables_count= `select count(*) + 1 + @@global.innodb_undo_tablespaces from information_schema.tables where engine = 'InnoDB'`
8687
set global innodb_encrypt_tables = OFF;
8788

8889
--echo # Wait max 10 min for key encryption threads to decrypt all spaces

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
-- source include/have_innodb.inc
22
-- source include/not_embedded.inc
33
-- source include/have_example_key_management_plugin.inc
4+
-- source include/innodb_undo_tablespaces.inc
45

56
CREATE TABLE t1 (f1 INT, f2 VARCHAR(256))engine=innodb;
67
INSERT INTO t1 VALUES(1, 'MariaDB'), (2, 'Robot'), (3, 'Science');
@@ -20,7 +21,7 @@ let $restart_parameters= --innodb_encryption_threads=5 --innodb_encryption_rotat
2021

2122
--echo # Wait until encryption threads have encrypted all tablespaces
2223

23-
--let $tables_count= `select count(*) + 1 from information_schema.tables where engine = 'InnoDB'`
24+
--let $tables_count= `select count(*) + 1 + @@global.innodb_undo_tablespaces from information_schema.tables where engine = 'InnoDB'`
2425
--let $wait_timeout= 600
2526
--let $wait_condition=SELECT COUNT(*) >= $tables_count FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
2627
--source include/wait_condition.inc
@@ -39,7 +40,7 @@ create table t4 (f1 int not null)engine=innodb encrypted=NO;
3940

4041
--echo # Wait until encryption threads have encrypted all tablespaces
4142

42-
--let $tables_count= `select count(*) from information_schema.tables where engine = 'InnoDB'`
43+
--let $tables_count= `select count(*) + @@global.innodb_undo_tablespaces from information_schema.tables where engine = 'InnoDB'`
4344
--let $wait_timeout= 600
4445
--let $wait_condition=SELECT COUNT(*) >= $tables_count FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
4546
--source include/wait_condition.inc
@@ -54,7 +55,7 @@ set global innodb_encrypt_tables = OFF;
5455

5556
--echo # Wait until encryption threads to decrypt all unencrypted tablespaces
5657

57-
--let $tables_count= `select count(*) from information_schema.tables where engine = 'InnoDB'`
58+
--let $tables_count= `select count(*) + @@global.innodb_undo_tablespaces from information_schema.tables where engine = 'InnoDB'`
5859
--let $wait_timeout= 600
5960
--let $wait_condition=SELECT COUNT(*) >= $tables_count FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 AND ROTATING_OR_FLUSHING = 0;
6061
--source include/wait_condition.inc
@@ -69,7 +70,7 @@ set global innodb_encrypt_tables = ON;
6970

7071
--echo # Wait until encryption threads to encrypt all unencrypted tablespaces
7172

72-
--let $tables_count= `select count(*) from information_schema.tables where engine = 'InnoDB'`
73+
--let $tables_count= `select count(*) + @@global.innodb_undo_tablespaces from information_schema.tables where engine = 'InnoDB'`
7374
--let $wait_timeout= 600
7475
--let $wait_condition=SELECT COUNT(*) >= $tables_count FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
7576
--source include/wait_condition.inc

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@
44

55
--source include/have_innodb.inc
66
--source include/have_file_key_management_plugin.inc
7+
--source include/innodb_undo_tablespaces.inc
78

89
let $datadir=`select @@datadir`;
910
--source include/shutdown_mysqld.inc
1011

1112
--remove_file $datadir/ib_logfile0
1213
--remove_file $datadir/ibdata1
14+
--remove_files_wildcard $datadir undo*
1315

1416
--source include/start_mysqld.inc
1517

0 commit comments

Comments
 (0)