mirror of
https://github.com/MariaDB/server.git
synced 2025-07-21 21:22:27 +03:00
The following INFORMATION_SCHEMA views were unnecessarily retrieving the data from the SYS_TABLESPACES table instead of directly fetching it from the fil_system cache: information_schema.innodb_tablespaces_encryption information_schema.innodb_tablespaces_scrubbing InnoDB always loads all tablespace metadata into memory at startup and never evicts it while the tablespace exists. With this fix, accessing these views will be much faster and use less memory, and include data about all tablespaces, including undo tablespaces. The view information_schema.innodb_sys_tablespaces will still reflect the contents of the SYS_TABLESPACES table.
73 lines
2.4 KiB
Plaintext
73 lines
2.4 KiB
Plaintext
SET GLOBAL innodb_file_per_table = ON;
|
|
SET GLOBAL innodb_file_format = `Barracuda`;
|
|
create table t1 (a varchar(255)) engine=innodb encrypted=yes;
|
|
create table t2 (a varchar(255)) engine=innodb;
|
|
show warnings;
|
|
Level Code Message
|
|
create table t3 (a varchar(255)) engine=innodb encrypted=no;
|
|
insert t1 values (repeat('foobarsecret', 12));
|
|
insert t2 values (repeat('tempsecret', 12));
|
|
insert t3 values (repeat('dummysecret', 12));
|
|
# Wait max 10 min for key encryption threads to encrypt all spaces
|
|
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
|
|
NAME
|
|
test/t3
|
|
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
|
|
NAME
|
|
innodb_system
|
|
mysql/innodb_index_stats
|
|
mysql/innodb_table_stats
|
|
test/t1
|
|
test/t2
|
|
# t1 yes on expecting NOT FOUND
|
|
NOT FOUND /foobarsecret/ in t1.ibd
|
|
# t2 ... on expecting NOT FOUND
|
|
NOT FOUND /tempsecret/ in t2.ibd
|
|
# t3 no on expecting FOUND
|
|
FOUND 12 /dummysecret/ in t3.ibd
|
|
# ibdata1 expecting NOT FOUND
|
|
NOT FOUND /foobarsecret/ in ibdata1
|
|
# Now turn off encryption and wait for threads to decrypt everything
|
|
SET GLOBAL innodb_encrypt_tables = off;
|
|
# Wait max 10 min for key encryption threads to decrypt all spaces
|
|
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
|
|
NAME
|
|
innodb_system
|
|
mysql/innodb_index_stats
|
|
mysql/innodb_table_stats
|
|
test/t2
|
|
test/t3
|
|
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
|
|
NAME
|
|
test/t1
|
|
# t1 yes on expecting NOT FOUND
|
|
NOT FOUND /foobarsecret/ in t1.ibd
|
|
# t2 ... default expecting FOUND
|
|
FOUND 12 /tempsecret/ in t2.ibd
|
|
# t3 no on expecting FOUND
|
|
FOUND 12 /dummysecret/ in t3.ibd
|
|
# ibdata1 expecting NOT FOUND
|
|
NOT FOUND /foobarsecret/ in ibdata1
|
|
# Now turn on encryption and wait for threads to encrypt all spaces
|
|
SET GLOBAL innodb_encrypt_tables = on;
|
|
# Wait max 10 min for key encryption threads to encrypt all spaces
|
|
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
|
|
NAME
|
|
test/t3
|
|
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
|
|
NAME
|
|
innodb_system
|
|
mysql/innodb_index_stats
|
|
mysql/innodb_table_stats
|
|
test/t1
|
|
test/t2
|
|
# t1 yes on expecting NOT FOUND
|
|
NOT FOUND /foobarsecret/ in t1.ibd
|
|
# t2 ... on expecting NOT FOUND
|
|
NOT FOUND /tempsecret/ in t2.ibd
|
|
# t3 no on expecting FOUND
|
|
FOUND 12 /dummysecret/ in t3.ibd
|
|
# ibdata1 expecting NOT FOUND
|
|
NOT FOUND /foobarsecret/ in ibdata1
|
|
drop table t1, t2, t3;
|