1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-17228 Encrypted temporary tables are not encrypted

- Introduce a new variable called innodb_encrypt_temporary_tables which is
a boolean variable. It decides whether to encrypt the temporary tablespace.
- Encrypts the temporary tablespace based on full checksum format.
- Introduced a new counter to track encrypted and decrypted temporary
tablespace pages.
- Warnings issued if temporary table creation has conflict value with
innodb_encrypt_temporary_tables
- Added a new test case which reads and writes the pages from/to temporary
tablespace.
This commit is contained in:
Thirunarayanan Balathandayuthapani
2019-06-27 16:23:03 +05:30
parent e4a0dbfb4a
commit 723a4b1d78
19 changed files with 280 additions and 72 deletions

View File

@ -3,6 +3,7 @@ show variables like 'innodb_encrypt%';
Variable_name Value
innodb_encrypt_log ON
innodb_encrypt_tables ON
innodb_encrypt_temporary_tables OFF
innodb_encryption_rotate_key_age 2
innodb_encryption_rotation_iops 100
innodb_encryption_threads 4

View File

@ -22,6 +22,8 @@ key (col_int_key),
key (col_char_key)
) ENGINE=InnoDB ENCRYPTED=YES ENCRYPTION_KEY_ID=1;
CREATE TEMPORARY TABLE t LIKE t0;
Warnings:
Warning 1478 Ignoring encryption parameter during temporary table creation.
INSERT INTO t VALUES
(NULL,1,1,'private','secret'),(NULL,2,2,'sacred','success'),
(NULL,3,3,'story','secure'),(NULL,4,4,'security','sacrament');

View File

@ -0,0 +1,19 @@
SELECT variable_value into @old_encrypted FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_temp_blocks_encrypted';
SELECT variable_value into @old_decrypted FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_temp_blocks_decrypted';
CREATE TEMPORARY TABLE t1(f1 CHAR(200), f2 CHAR(200)) ENGINE=InnoDB;
INSERT INTO t1 (f1,f2) SELECT '', '' FROM seq_1_to_8192;
CREATE TEMPORARY TABLE t2(f1 CHAR(100), f2 CHAR(200), f3 CHAR(200))ENGINE=InnoDB;
INSERT INTO t2 (f1,f2,f3) SELECT '', '', '' FROM seq_1_to_8192;
SELECT COUNT(*) FROM t1;
COUNT(*)
8192
SELECT variable_value > @old_encrypted FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_temp_blocks_encrypted';
variable_value > @old_encrypted
1
SELECT variable_value > @old_decrypted FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_temp_blocks_decrypted';
variable_value > @old_decrypted
1

View File

@ -3,6 +3,7 @@ SHOW VARIABLES LIKE 'innodb_encrypt%';
Variable_name Value
innodb_encrypt_log ON
innodb_encrypt_tables ON
innodb_encrypt_temporary_tables OFF
innodb_encryption_rotate_key_age 15
innodb_encryption_rotation_iops 100
innodb_encryption_threads 4
@ -57,6 +58,7 @@ SHOW VARIABLES LIKE 'innodb_encrypt%';
Variable_name Value
innodb_encrypt_log ON
innodb_encrypt_tables OFF
innodb_encrypt_temporary_tables OFF
innodb_encryption_rotate_key_age 15
innodb_encryption_rotation_iops 100
innodb_encryption_threads 0