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

Duplicate COLLATE clause in ALTER TABLE causes OM=>NS replication failure

    XMLWordPrintable

Details

    Description

      CREATE TABLE t (a INT);
      ALTER TABLE t COLLATE utf8_general_ci, COLLATE utf8_bin;
       
      DROP TABLE t;
      

      Before 10.9.1, specifically before this commit

      commit 208addf48444c0a36a2cc16cd2558ae694e905d5
      Author: Alexander Barkov
      Date:   Tue May 17 12:52:23 2022 +0400
       
          Main patch MDEV-27896 Wrong result upon `COLLATE latin1_bin CHARACTER SET latin1` on the table or the database level
      

      the above ALTER would succeed quietly, altering the table to the second collation.

      Starting from this commit, it fails with ER_CONFLICTING_DECLARATIONS:

      10.11 2d1e019f4f5ada670aa6baaea0a126a4d32abe30

      mysqltest: At line 2: query 'ALTER TABLE t COLLATE utf8_general_ci, COLLATE utf8_bin' failed: ER_CONFLICTING_DECLARATIONS (1302): Conflicting declarations: 'COLLATE utf8mb3_general_ci' and 'COLLATE utf8mb3_bin'
      

      The error as such is not big news, with CHARACTER SET it happened before; but as with any tightening in behavior, it may cause a replication failure: the statement passes on an old primary, gets written to the binlog, fails on a replica, replication aborts.

      I'm setting it to trivial as the workaround is obvious – don't do it, there should be no practical reason to use two COLLATE clauses in the same ALTER.

      Attachments

        Issue Links

          Activity

            People

              bar Alexander Barkov
              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.