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

Inconsistent errors upon ALTER ONLINE IGNORE, OM=>NS replication affected

    XMLWordPrintable

Details

    Description

      --source include/have_innodb.inc
       
      CREATE TABLE t (a INT PRIMARY KEY, UNIQUE(a DESC)) ENGINE=InnoDB;
      INSERT INTO t VALUES (1); # Optional, does not affect the outcome
      ALTER ONLINE IGNORE TABLE t DROP PRIMARY KEY;
       
      DROP TABLE t;
      

      Starting from this commit in 10.9.1

      commit a4cac0e07ad7f0909be3f66676e800e20c6b9fa8
      Author: Sergei Golubchik
      Date:   Wed Nov 24 16:50:21 2021 +0100
       
          MDEV-26938 Support descending indexes internally in InnoDB (server part)
      

      ALTER in the test case causes an error.
      In 10.9-11.1, it was/is

      10.11 2d1e019f4f5ada670aa6baaea0a126a4d32abe30

      mysqltest: At line 5: query 'ALTER ONLINE IGNORE TABLE t DROP PRIMARY KEY' failed: ER_ALTER_OPERATION_NOT_SUPPORTED_REASON (1846): LOCK=NONE is not supported. Reason: Creating unique indexes with IGNORE requires COPY algorithm to remove duplicate rows. Try LOCK=SHARED
      

      In 11.2 with online alter it became

      11.2 67c0fd2a41034eae1ea04b81cace6a154783aedd

      mysqltest: At line 5: query 'ALTER ONLINE IGNORE TABLE t DROP PRIMARY KEY' failed: ER_ALTER_OPERATION_NOT_SUPPORTED_REASON (1846): LOCK=NONE is not supported. Reason: ALTER IGNORE TABLE. Try LOCK=SHARED
      

      It would seem quite intentional, but oddly, with the same test case but non-DESC unique key, the ALTER passes, both on 10.9-11.1 and on 11.2+:

      11.2 67c0fd2a41034eae1ea04b81cace6a154783aedd

      CREATE TABLE t (a INT PRIMARY KEY, UNIQUE(a)) ENGINE=InnoDB;
      INSERT INTO t VALUES (1);
      ALTER ONLINE IGNORE TABLE t DROP PRIMARY KEY;
      DROP TABLE t;
      bug.t2                                   [ pass ]      6
      

      so the reasons given in error messages above look strange.

      Also, if the error upon ALTER is indeed intentional, it causes a problem with OM=>NS replication. The ALTER passes on a pre-10.9.1 primary, is written in the binlog, gets executed on a replica and fails there, causing replication abort.

      Attachments

        Issue Links

          Activity

            People

              serg Sergei Golubchik
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              3 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.