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

DISCARD/IMPORT TABLESPACE does not work for system-versioned table after adding a column

    XMLWordPrintable

Details

    Description

      It may have to be documented as a limitation, which will be a pity: first, system_versioning_alter_history is specifically recommended for adding new columns to the table, and secondly, apparently real-life users employ DISCARD/IMPORT TABLESPACE for the purpose of backing/restoring or moving data in system-versioned tables, due to the lack of functionality in mysqldump.

      --source include/have_innodb.inc
       
      --let $datadir= `select @@datadir`
       
      SET system_versioning_alter_history= KEEP;
      CREATE TABLE t1 (a INT) ENGINE=InnoDB WITH SYSTEM VERSIONING;
      ALTER TABLE t1 ADD b INT;
      FLUSH TABLES t1 FOR EXPORT;
      --copy_file $datadir/test/t1.cfg $MYSQLTEST_VARDIR/t1.cfg
      --copy_file $datadir/test/t1.ibd $MYSQLTEST_VARDIR/t1.ibd
      UNLOCK TABLES;
       
      DROP TABLE t1;
      CREATE TABLE `t1` (
        `a` int(11) DEFAULT NULL,
        `b` int(11) DEFAULT NULL
      ) ENGINE=InnoDB WITH SYSTEM VERSIONING;
       
      ALTER TABLE t1 DISCARD TABLESPACE;
      --copy_file $MYSQLTEST_VARDIR/t1.cfg $datadir/test/t1.cfg
      --copy_file $MYSQLTEST_VARDIR/t1.ibd $datadir/test/t1.ibd
      ALTER TABLE t1 IMPORT TABLESPACE;
       
      # Cleanup
      DROP TABLE t1;
      

      10.3 e59c1cef

      query 'ALTER TABLE t1 IMPORT TABLESPACE' failed: 1808: Schema mismatch (Column b ordinal value mismatch, it's at 1 in the table and 3 in the tablespace meta-data file)
      

      Attachments

        Issue Links

          Activity

            People

              marko Marko Mäkelä
              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.