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

Atomic CREATE OR REPLACE fails if a table cannot be decrypted

    XMLWordPrintable

Details

    Description

      If a table cannot be decrypted, e.g. there is no key management plugin or the correct key, CREATE OR REPLACE fails, the table has to be dropped (which is possible) and only then be created again.
      It happens both with InnoDB and Aria. However, with Aria, it didn't work anyway, even with the old CREATE OR REPLACE; with InnoDB it did work, so it's a regression, although I don't consider it an important one.
      With drop_before_create_or_replace=on it works as before.

      --source include/have_innodb.inc
       
      --let $restart_parameters = --plugin-load-add=file_key_management --file-key-management-filename=$SECURE_LOAD_PATH/keys.txt --aria-encrypt-tables=on --innodb-encrypt-tables=on
       
      --source include/restart_mysqld.inc
       
      create table t_inno (a int) engine=innodb;
      insert into t_inno values (1);
      create table t_aria (b int) engine=aria;
      insert into t_aria values (2);
       
      --let $restart_parameters =
      --source include/restart_mysqld.inc
       
      #--error 0,ER_TABLE_CORRUPT
      create or replace table t_inno (c int) engine=innodb;
      #--error 0,HA_ERR_NO_ENCRYPTION
      create or replace table t_aria (d int) engine=aria;
       
      show tables;
      drop table if exists t_inno, t_aria;
      show tables;
      

      Below is the result of the test run with --force --force, so that it runs to the end:

      bb-13.0-MDEV-25292-acor 291a9c28cdf6c019bc5cab85be06f52dc9450bfe

      create or replace table t_inno (c int) engine=innodb;
      mysqltest: At line 16: query 'create or replace table t_inno (c int) engine=innodb' failed: ER_TABLE_CORRUPT (1877): Table `test`.`t_inno` is corrupted. Please drop the table and recreate.
      create or replace table t_aria (d int) engine=aria;
      mysqltest: At line 18: query 'create or replace table t_aria (d int) engine=aria' failed: HA_ERR_NO_ENCRYPTION (199): Initialization of encryption failed for ./test/t_aria.MAD
      

      Baseline:

      main ef4be39bfcbae1b0090a3098e511d14457d6139f

      create or replace table t_inno (c int) engine=innodb;
      create or replace table t_aria (d int) engine=aria;
      mysqltest: At line 18: query 'create or replace table t_aria (d int) engine=aria' failed: HA_ERR_NO_ENCRYPTION (199): Initialization of encryption failed for ./test/t_aria.MAD
      

      Attachments

        Issue Links

          Activity

            People

              monty Michael Widenius
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

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