Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-19509

InnoDB skips the tablespace in rotation list

Details

    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.

      Attachments

        Issue Links

          Activity

            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.

            thiru Thirunarayanan Balathandayuthapani added a comment - - edited 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.

            People

              thiru Thirunarayanan Balathandayuthapani
              thiru Thirunarayanan Balathandayuthapani
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.