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

EXCHANGE PARTITION allows different index direction, but causes further errors

    XMLWordPrintable

Details

    Description

      EXCHANGE PARTITION allows a key to be ascending on one participating table and descending on another, but further DML on the table causes errors.

      --source include/have_partition.inc
       
      CREATE TABLE t1 (a INT, KEY(a DESC)) PARTITION BY KEY(a) PARTITIONS 4;
      INSERT INTO t1 VALUES (6),(3),(2),(1);
       
      CREATE TABLE t2 (a INT, KEY(a));
       
      ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
      INSERT INTO t1 VALUES (5),(4);
       
      # Cleanup
      DROP TABLE t1, t2;
      

      10.8 0c5d1342 with MyISAM

      mysqltest: At line 9: query 'INSERT INTO t1 VALUES (5),(4)' failed: ER_GET_ERRNO (1030): Got error 190 "Incompatible key or row definition between the MariaDB .frm file and the information in the storage engine. You may have retry " from storage engine MyISAM
      

      With InnoDB INSERT doesn't fail, but errors are written in the log:

      with InnoDB

      ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
      INSERT INTO t1 VALUES (5),(4);
      DROP TABLE t1, t2;
      bug.part2                                [ fail ]  Found warnings/errors in server log file!
              Test ended at 2022-01-30 15:14:13
      line
      2022-01-30 15:14:13 4 [ERROR] Found index a whose column info does not match that of MariaDB.
      2022-01-30 15:14:13 4 [ERROR] InnoDB indexes are inconsistent with what defined in .frm for table ./test/t1#P#p0
      ^ Found warnings in /mnt8t/bld/10.8-debug-nightly/mysql-test/var/log/mysqld.1.err
      

      With Aria, no errors are returned, which is more suspicious than soothing.

      In MariaDB KB the description of EXCHANGE PARTITION is scarce, but MySQL manual says

      Table nt is not itself partitioned.
      Table nt is not a temporary table.
      The structures of tables pt and nt are otherwise identical.
      ...

      (there are 9 more points, but none of them changes the above)

      However MySQL as of 8.0.28 also allows such EXCHANGE, and InnoDB errors/warnings also end up in the error log.

      Attachments

        Issue Links

          Activity

            People

              serg Sergei Golubchik
              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.