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

Result of DISCARD TABLESPACE depends on innodb_stats_persistent

    XMLWordPrintable

Details

    Description

      Note: Observed on bb-10.1-jan-encryption. The test case below is pretty much the same as in MDEV-8750, just a little bit simplified. I don't know whether the issue is anyhow related to encryption, maybe it can be observed without it, I'm just using the test case that I already have.

      Test flow

      - start server with the encryption plugin;
      - create and populate an encrypted InnoDB table;
      - restart server without the encryption plugin;
      - attempt to select from the table (error);
      - attempt to discard tablespace of the table
        => problem

      The problem is that the result of DISCARD TABLESPACE is different if the server was started with innodb_stats_persistent enabled (default) or disabled. If it's disnabled, the ALTER succeeds with warnings. If it's enabled, ALTER fails.

      Dependency on a seemingly unrelated option is disturbing, so at least it's worth checking whether it's intentional.

      Test case

      --source include/have_innodb.inc
       
      --exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
      --shutdown_server
      --source include/wait_until_disconnected.inc
       
      --write_file $MYSQLTEST_VARDIR/keys1.txt
      1;770A8A65DA156D24EE2A093277530142
      EOF
       
      --exec echo "restart:--plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys1.txt" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
      --enable_reconnect
      --source include/wait_until_connected_again.inc
       
      CREATE TABLE t1 (pk INT PRIMARY KEY, f VARCHAR(8)) ENGINE=InnoDB ENCRYPTED=YES;
      INSERT INTO t1 VALUES (1,'foo'),(2,'bar');
       
      --exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
      --shutdown_server
      --source include/wait_until_disconnected.inc
       
      --write_file $MYSQLTEST_VARDIR/keys2.txt
      1;770A8A65DA156D24EE2A093277530143
      EOF
       
      --exec echo "restart:--plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys2.txt" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
      --enable_reconnect
      --source include/wait_until_connected_again.inc
       
      --error ER_NO_SUCH_TABLE_IN_ENGINE
      select * from t1;
      --error ER_NO_SUCH_TABLE_IN_ENGINE
      alter table t1 discard tablespace;

      Result 1

      # Run with --mysqld=--innodb-stats-persistent=1
       
      select * from t1;
      ERROR 42S02: Table 'test.t1' doesn't exist in engine
      alter table t1 discard tablespace;
      ERROR 42S02: Table 'test.t1' doesn't exist in engine
      bug.t6 'innodb_plugin'                   [ fail ]  Found warnings/errors in server log file!
              Test ended at 2015-09-04 14:43:23
      line
      2015-09-04 14:43:23 140172686374656 [ERROR] InnoDB: Block in space_id 4 in file test/t1 encrypted.
      2015-09-04 14:43:23 140172686374656 [ERROR] InnoDB: However key management plugin or used key_id 1 is not found or used encryption algorithm or method does not match.
      2015-09-04 14:43:23 140172686374656 [ERROR] InnoDB: Marking tablespace as missing. You may drop this table or install correct key management plugin and key file.
      2015-09-04 14:43:23 140172686374656 [ERROR] InnoDB: Block in space_id 4 in file test/t1 encrypted.
      2015-09-04 14:43:23 140172686374656 [ERROR] InnoDB: However key management plugin or used key_id 1 is not found or used encryption algorithm or method does not match.
      2015-09-04 14:43:23 140172686374656 [ERROR] InnoDB: Marking tablespace as missing. You may drop this table or install correct key management plugin and key file.

      Result 2

      # Run with --mysqld=--innodb-stats-persistent=0
       
      select * from t1;
      ERROR 42S02: Table 'test.t1' doesn't exist in engine
      alter table t1 discard tablespace;
      bug.t6 'innodb_plugin'                   [ fail ]
              Test ended at 2015-09-04 14:44:34
       
      CURRENT_TEST: bug.t6
      mysqltest: At line 33: query 'alter table t1 discard tablespace' succeeded - should have failed with errno 1932...
       
      Warnings from just before the error:
      Warning 1812 Tablespace is missing for table 'test/t1'

      Attachments

        Activity

          People

            jplindst Jan Lindström (Inactive)
            elenst Elena Stepanova
            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.