[MDEV-19509] InnoDB skips the tablespace in rotation list Created: 2019-05-17  Updated: 2019-05-28  Resolved: 2019-05-28

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - InnoDB
Affects Version/s: 10.2.24, 10.3.15, 10.4.4
Fix Version/s: 10.2.25, 10.3.16, 10.4.6

Type: Bug Priority: Major
Reporter: Thirunarayanan Balathandayuthapani Assignee: Thirunarayanan Balathandayuthapani
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-14398 When innodb_encryption_rotate_key_age... Closed

 Description   

In two cases, InnoDB unnecessary skips the tablespaces from the rotation list.
case 1: All tablespace are unencrypted tables but it needs encryption (crypt_data initialization)
case 2: Changing innodb_encrypt_tables when background thread iterates through one
of the tablespace in rotation list.

The following test case can repeat the scenario for Case 1 :

-- source include/have_innodb.inc
-- source include/not_embedded.inc
-- source include/have_example_key_management_plugin.inc
 
set global innodb_encrypt_tables=0;
CREATE TABLE t1 (f1 INT, f2 VARCHAR(256))engine=innodb;
INSERT INTO t1 VALUES(1, 'MariaDB'), (2, 'Robot'), (3, 'Science');
INSERT INTO t1 SELECT * FROM t1;
 
CREATE TABLE t2(f1 INT, f2 VARCHAR(256))engine=innodb;
INSERT INTO t2 SELECT * FROM t1;
 
let $restart_parameters=--innodb_encrypt_tables=1;
--source include/restart_mysqld.inc
 
set global innodb_encrypt_tables=1;
 
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
NAME
innodb_system
 
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
NAME
drop table t2, t1;

case 2: As of now, I found out by reading the code. I can write the clumsy test case to repeat it. I will post the test case soon.



 Comments   
Comment by Thirunarayanan Balathandayuthapani [ 2019-05-17 ]

case 1:

fil_crypt_start_converting allows only one thread to do the write of crypt data to page 0 and flush all the pages up to the particular LSN.
If other tablespaces need initialization of crypt data and it is fetched by other encryption threads then these tablespaces can be ignored (because of
fil_crypt_start_converting) and removal of tablespace from the rotation list.

After MDEV-14398 fix, set global innodb_encrypt_tables statement can be used to invoke to do encryption/decryption of tablespaces
when key_rotate_age is 0. But with case(1), it will skip the few tablespaces which needed encryption/decryption based on innodb_encrypt_tables value.

Generated at Thu Feb 08 08:52:14 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.