Bug #45953 Foreign keys: hang if alter partition
Submitted: 5 Jul 2009 23:52 Modified: 20 Dec 2013 6:51
Reporter: Trudy Pelzer Email Updates:
Status: Won't fix Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:6.1.0-alpha-debug OS:Linux (SUSE 10.2)
Assigned to: CPU Architecture:Any

[5 Jul 2009 23:52] Trudy Pelzer
Description:
I'm using mysql-6.1-fk-stage.
I start the server with mysqld --foreign-key-all-engines=1.

I create a parent and a child table.
I alter the partitioning on both tables.
Hang.

How to repeat:
DROP TABLE IF EXISTS t2,t1;
CREATE TABLE t1 (s1 INT PRIMARY KEY) engine=innodb PARTITION BY HASH(s1);
CREATE TABLE t2 (s1 INT REFERENCES t1(s1) ON UPDATE CASCADE) engine=innodb;
UPDATE t1 SET s1 = s1 + 2;
ALTER TABLE t1 DROP PARTITION p1;
ALTER TABLE t2 PARTITION BY HASH(s1);

At this point there is a hang.
[7 Jul 2009 6:58] Dmitry Lenev
Verified as described. Note that first ALTER TABLE statement in the above test case emits an error (which is expected).
[7 Jul 2009 11:44] Dmitry Lenev
Hello!

Preliminary investigation shows that this bug is not related to the new foreign key implementation. It can be reproduced even in mysql-azalea tree using the following test case:

--source include/have_innodb.inc

DROP TABLE IF EXISTS t2,t1;
CREATE TABLE t1 (s1 INT PRIMARY KEY) engine=innodb PARTITION BY HASH(s1);
LOCK TABLES t1 WRITE, t1 b READ;
UNLOCK TABLES;
--error 1512
ALTER TABLE t1 DROP PARTITION p1;
--echo # The below SELECT hands similarly to the second ALTER TABLE in the
--echo # above test case in tdc_wait_for_old_versions()
SELECT * FROM t1;
[15 Jul 2009 10:23] Dmitry Lenev
Hello!

I have reported bug #46198 "Hang after failed ALTER TABLE on partitioned table" to get this problem properly verified/triaged/fixed in Azalea.
[20 Dec 2013 6:51] Erlend Dahl
6.x project was abandoned years ago.