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

Unexpected ER_TABLE_EXISTS_ERROR on primary or replica upon CREATE OR REPLACE for partitioned table

    XMLWordPrintable

Details

    Description

      --source include/have_innodb.inc
      --source include/have_partition.inc
       
      CREATE TABLE t (
        a INT,
        row_start BIGINT UNSIGNED GENERATED ALWAYS AS ROW START,
        row_end BIGINT UNSIGNED GENERATED ALWAYS AS ROW END,
        PERIOD FOR SYSTEM_TIME (row_start, row_end)
      ) ENGINE=InnoDB WITH SYSTEM VERSIONING
       PARTITION BY HASH (a);
      CREATE OR REPLACE TABLE t (b INT) ENGINE=InnoDB WITH SYSTEM VERSIONING PARTITION BY SYSTEM_TIME;
       
      DROP TABLE t;
      

      11.8 5203aeffb48bc8a23e09104d13b11d8fd2415fd4

      mysqltest: At line 11: query 'CREATE OR REPLACE TABLE t (b INT) ENGINE=InnoDB WITH SYSTEM VERSIONING PARTITION BY SYSTEM_TIME' failed: ER_TABLE_EXISTS_ERROR (1050): Table '`test`.`t` /* Partition `p0` */' already exists
      

      If I drop in SELECT between two CREATE statements, the second one succeeds, but then it fails on a slave:

      --source include/have_innodb.inc
      --source include/have_partition.inc
      --source include/master-slave.inc
       
      CREATE TABLE t (
        a INT,
        row_start BIGINT UNSIGNED GENERATED ALWAYS AS ROW START,
        row_end BIGINT UNSIGNED GENERATED ALWAYS AS ROW END,
        PERIOD FOR SYSTEM_TIME (row_start, row_end)
      ) ENGINE=InnoDB WITH SYSTEM VERSIONING
       PARTITION BY HASH (a);
      SELECT * FROM t;
      CREATE OR REPLACE TABLE t (b INT) ENGINE=InnoDB WITH SYSTEM VERSIONING PARTITION BY SYSTEM_TIME;
       
      --sync_slave_with_master
       
      --connection master
      DROP TABLE t;
       
      --source include/rpl_end.inc
      

      Last_Errno	1050
      Last_Error	Error 'Table '`test`.`t` /* Partition `p0` */' already exists' on query. Default database: 'test'. Query: 'CREATE OR REPLACE TABLE t (b INT) ENGINE=InnoDB WITH SYSTEM VERSIONING PARTITION BY SYSTEM_TIME'
      

      The failure started happening after this commit in 11.7.1:

      commit aa09cb3b11dbd3c8e36055343beeddecf5248168
      Author: Sergei Golubchik
      Date:   Sat Jan 27 00:15:40 2024 +0100
       
          open frm for DROP TABLE
      

      Attachments

        Activity

          People

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