Bug #46137 Foreign keys: hang if add column
Submitted: 12 Jul 2009 19:39 Modified: 20 Dec 2013 6:51
Reporter: Peter Gulutzan Email Updates:
Status: Won't fix Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:6.1.0-alpha-debug-log OS:Linux (SUSE 11.1 64-bit)
Assigned to: CPU Architecture:Any

[12 Jul 2009 19:39] Peter Gulutzan
Description:
I'm using mysql-6.1-fk-stage.
I start the server with --foreign-key-all-engines=1.

I create a partitioned parent table and a child table.
I do several alters, the last alter fails.
I try to do one more alter to add a column.
Hang.

See also Bug#45953 Foreign keys: hang if alter partition

How to repeat:
drop database d;
create database d;
use d
create table t1 (s1 varchar(5) primary key) engine=innodb partition by key(s1);
create table t2 (s1 varchar(5) references t1 (s1)) engine=innodb;                                                                                                        
alter table t2 add column (s3 varchar(5) references t1(s1));
alter table t2 add primary key (s1);
ALTER TABLE t1 ADD COLUMN (s3 VARCHAR(5) UNIQUE);
ALTER TABLE t1 ADD COLUMN (s3 VARCHAR(5));
[13 Jul 2009 8:00] Dmitry Lenev
Hello Peter!

Similar to case with bug #45953 this problem is repeatable without any foreign keys even in mysql-azalea tree, using the following test case:

-- source include/have_innodb.inc

create table t1 (s1 varchar(5) primary key) engine=innodb partition by key(s1);
lock tables t1 a write, t1 b read;
unlock tables;
--error 1503
ALTER TABLE t1 ADD COLUMN (s3 VARCHAR(5) UNIQUE);
--echo # Hangs due to the same reason/with the same stack-trace as original
--echo # test case.
ALTER TABLE t1 ADD COLUMN (s3 VARCHAR(5));

This means that this problem is not specific to new implementation of foreign keys. Actually, after primary investigation I suspect that this bug is duplicate of bug #45953.
[13 Jul 2009 19:11] Peter Gulutzan
Mr Lenev's comment is correct, it's possible that this is a duplicate.
But let's wait for further investigation before declaring it thus.
Reclassify as Server: Partitioning and assign to someone else?
[15 Jul 2009 10:24] 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.