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

ALTER TABLE…IMPORT TABLESPACE may break MVCC

    XMLWordPrintable

Details

    • Unexpected results
    • A snapshot that was created before ALTER TABLE…IMPORTED TABLESPACE would fail to report ER_TABLE_DEF_CHANGED.

    Description

      Oracle released a MySQL bug fix without a test case:
      Bug#36999166 ALTER TABLE ... IMPORT TABLESPACE may cause unsafe reads
      It is easy to reproduce this with a small change to an existing test case:

      diff --git a/mysql-test/suite/innodb/t/import_bugs.test b/mysql-test/suite/innodb/t/import_bugs.test
      index 1b7edcf8f73..82aa6e0996c 100644
      --- a/mysql-test/suite/innodb/t/import_bugs.test
      +++ b/mysql-test/suite/innodb/t/import_bugs.test
      @@ -53,6 +53,10 @@ CREATE TABLE t1(
       
       CREATE TABLE t2 LIKE t1;
       
      +--connect mvcc,localhost,root
      +START TRANSACTION WITH CONSISTENT SNAPSHOT;
      +--connection default
      +
       ALTER TABLE t2 DISCARD TABLESPACE;
       
       INSERT INTO t1() VALUES();
      @@ -80,6 +84,11 @@ INSERT INTO t2() VALUES();
       INSERT INTO t2() VALUES();
       
       SELECT * FROM t2 ORDER BY id;
      +
      +--connection mvcc
      +SELECT * FROM t2;
      +--disconnect mvcc
      +--connection default
       DROP TABLE t2;
       
       --echo #
      

      We would expect the SELECT to fail with an error. Instead, it is returning the contents of the imported table, which does not correspond to the snapshot.

      Attachments

        Issue Links

          Activity

            People

              marko Marko Mäkelä
              marko Marko Mäkelä
              Alessandro Vetere Alessandro Vetere
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0d
                  0d
                  Logged:
                  Time Spent - 1h 5m
                  1h 5m

                  Git Integration

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