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

Assertion `err != DB_DUPLICATE_KEY' failed in row_rename_table_for_mysql & ERROR 1050 (42S01): Table './test/t1' already exists for simple ALTER TABLE on optimized builds (Related to MDEV-25509)

    XMLWordPrintable

    Details

      Description

      SET old_alter_table=1;
      CREATE TABLE t1 (a VARCHAR(10) NOT NULL PRIMARY KEY) ENGINE=InnoDB;
      CREATE TABLE t1_fk (a VARCHAR(40), KEY a (a), FULLTEXT KEY(a), CONSTRAINT fk FOREIGN KEY(a) REFERENCES t1 (a) ON UPDATE CASCADE) ENGINE=InnoDB;
      ALTER TABLE t1 RENAME TO tm1;
      CREATE TABLE t1 (c1 BIGINT NOT NULL, c2 BIGINT NOT NULL, PRIMARY KEY(c1), UNIQUE KEY(c2)) ENGINE=MEMORY;
      ALTER TABLE t1 ENGINE=InnoDB;
      

      This testcase would sporadically (4 out of 5 times) crash build 10.6 at 9db14e93acc4ec9023d50686c66dbef7d4d8c15c, and would also crash 10.5 at dd07cfcecd4aabb0aeae9c4f5087f82b4080c1bd. See MDEV-25509.

      Now, it does not look healthy on a build from today:

      10.6.1 f8665314d4ba190679001b81bb7d9fd7a38fc0f6 (Optimized)

      10.6.1-opt>SET old_alter_table=1;
      Query OK, 0 rows affected, 1 warning (0.000 sec)
       
      10.6.1-opt>CREATE TABLE t1 (a VARCHAR(10) NOT NULL PRIMARY KEY) ENGINE=InnoDB;
      Query OK, 0 rows affected (0.015 sec)
       
      10.6.1-opt>CREATE TABLE t1_fk (a VARCHAR(40), KEY a (a), FULLTEXT KEY(a), CONSTRAINT fk FOREIGN KEY(a) REFERENCES t1 (a) ON UPDATE CASCADE) ENGINE=InnoDB;
      Query OK, 0 rows affected (0.091 sec)
       
      10.6.1-opt>ALTER TABLE t1 RENAME TO tm1;
      ERROR 1451 (23000): Cannot delete or update a parent row: a foreign key constraint fails
      10.6.1-opt>CREATE TABLE t1 (c1 BIGINT NOT NULL, c2 BIGINT NOT NULL, PRIMARY KEY(c1), UNIQUE KEY(c2)) ENGINE=MEMORY;
      Query OK, 0 rows affected (0.008 sec)
       
      10.6.1-opt>ALTER TABLE t1 ENGINE=InnoDB;
      ERROR 1050 (42S01): Table './test/t1' already exists
      10.6.1-opt>  
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              thiru Thirunarayanan Balathandayuthapani
              Reporter:
              Roel Roel Van de Paar
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: