mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-16060 - InnoDB: Failing assertion: ut_strcmp(index->name, key->name)
A sequel to9180e86
and149b754
. ALTER TABLE ... ADD FOREIGN KEY may crash if parent table is updated concurrently. Block FK parent table updates even earlier, before intermediate child table is created. Use proper charset info for my_casedn_str() and don't update original identifiers so that lower_cast_table_names == 2 is honoured.
This commit is contained in:
@ -100,3 +100,27 @@ CREATE TABLE t2 (b INT, KEY(b)) ENGINE=InnoDB;
|
||||
INSERT INTO t2 VALUES(2);
|
||||
ALTER TABLE t2 ADD FOREIGN KEY(b) REFERENCES t1(a), LOCK=EXCLUSIVE;
|
||||
DROP TABLE t2, t1;
|
||||
#
|
||||
# MDEV-16060 - InnoDB: Failing assertion: ut_strcmp(index->name, key->name)
|
||||
#
|
||||
CREATE TABLE t1 (`pk` INT PRIMARY KEY) ENGINE=InnoDB;
|
||||
CREATE TABLE t2 LIKE t1;
|
||||
FLUSH TABLES;
|
||||
SET debug_sync='alter_table_intermediate_table_created SIGNAL ready WAIT_FOR go';
|
||||
ALTER TABLE t1 ADD FOREIGN KEY(pk) REFERENCES t2(pk) ON UPDATE CASCADE;
|
||||
connect con1, localhost, root;
|
||||
SET debug_sync='now WAIT_FOR ready';
|
||||
SET lock_wait_timeout=1;
|
||||
UPDATE t2 SET pk=10 WHERE pk=1;
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
PREPARE stmt FROM 'UPDATE t2 SET pk=10 WHERE pk=1';
|
||||
DEALLOCATE PREPARE stmt;
|
||||
FLUSH TABLE t2;
|
||||
SET debug_sync='now SIGNAL go';
|
||||
connection default;
|
||||
disconnect con1;
|
||||
connection default;
|
||||
SET debug_sync='reset';
|
||||
SHOW OPEN TABLES FROM test;
|
||||
Database Table In_use Name_locked
|
||||
DROP TABLE t1, t2;
|
||||
|
Reference in New Issue
Block a user