1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

MDEV-25509 Atomic DDL: Assertion `err != DB_DUPLICATE_KEY' fails

after previous error upon multi-RENAME

- InnoDB fails to rename the foreign key constraint while
rollbacking the rename operation. In that case, InnoDB should
rename the FK constraint too.
This commit is contained in:
Thirunarayanan Balathandayuthapani
2021-04-30 16:39:06 +05:30
parent fd8c68c7fe
commit 9fe681c9e4
4 changed files with 35 additions and 2 deletions

View File

@@ -1,3 +1,4 @@
call mtr.add_suppression("InnoDB: In RENAME TABLE table `test`.`t4` is referenced in foreign key constraints which are not compatible with the new table definition.");
CREATE DATABASE test_jfg;
CREATE DATABASE test_jfg2;
CREATE TABLE test_jfg.test (a int unsigned PRIMARY KEY) ENGINE=InnoDB;
@@ -26,3 +27,16 @@ RENAME TABLE t1 TO non_existing_db.t1;
ERROR HY000: Error on rename of './test/t1' to './non_existing_db/t1' (errno: 168 "Unknown (generic) error from engine")
FOUND 1 /\[ERROR\] InnoDB: Cannot rename file '.*t1\.ibd' to '.*non_existing_db/ in mysqld.1.err
DROP TABLE t1;
#
# MDEV-25509 Atomic DDL: Assertion `err != DB_DUPLICATE_KEY'
# fails after previous error upon multi-RENAME
#
SET FOREIGN_KEY_CHECKS= OFF;
CREATE TABLE t1 (pk INT PRIMARY KEY, f INT, FOREIGN KEY (f) REFERENCES t4 (x)) ENGINE=InnoDB;
ALTER TABLE t1 DROP KEY f;
CREATE TABLE t2 (a INT) ENGINE=InnoDB;
RENAME TABLE t1 TO t3, t3 TO t4;
ERROR HY000: Error on rename of './test/t3' to './test/t4' (errno: 150 "Foreign key constraint is incorrectly formed")
RENAME TABLE t2 TO t3;
DROP TABLE t3, t1;
SET FOREIGN_KEY_CHECKS=DEFAULT;