Bug #35529 Foreign keys: crash dropping partitioned referenced table
Submitted: 24 Mar 2008 17:46 Modified: 29 Apr 2008 8:39
Reporter: Peter Gulutzan Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:6.1 OS:Linux (SUSE 10 | 32-bit)
Assigned to: Dmitry Lenev CPU Architecture:Any

[24 Mar 2008 17:46] Peter Gulutzan
Description:
I'm using mysql-6.1-fk.
I start mysqld with --foreign-key-all-engines=1.

I create a table which contains a referential constraint
and a partition.
I try to drop the table. Failure.
I try again to drop the table. Crash.

How to repeat:
mysql>      create table k1 (s1 int primary key);
Query OK, 0 rows affected (0.08 sec)

mysql>      create table k7 (s1 int references k1(s1)) engine=innodb partition by range (s1) (partition p1 values less than (1));
Query OK, 0 rows affected (0.13 sec)

mysql>      drop table k7;
ERROR 1037 (HY001): Out of memory; restart server and try again (needed 2 bytes)
mysql>      drop table k7;
ERROR 2013 (HY000): Lost connection to MySQL server during query
[24 Mar 2008 21:58] MySQL Verification Team
Thank you for the bug report.

[miguel@mirador dbs]$ 6.1fk/bin/mysql -uroot db3
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 6.1.0-fk-debug Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> create table k1 (s1 int primary key);
Query OK, 0 rows affected (0.01 sec)

mysql> create table k7 (s1 int references k1(s1)) engine=innodb partition by range
    -> (s1) (partition p1 values less than (1));
Query OK, 0 rows affected (0.01 sec)

mysql> drop table k7;
ERROR 1037 (HY001): Out of memory; restart server and try again (needed 2 bytes)
mysql> drop table k7;
ERROR 2013 (HY000): Lost connection to MySQL server during query
mysql>
[22 Apr 2008 12:19] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/45820

ChangeSet@1.2607, 2008-04-22 16:18:54+04:00, dlenev@mockturtle.local +7 -0
  Tentative fix for bug #35529 "Foreign keys: crash dropping partitioned
  referenced table".
  
  In --foreign-key-all-engines mode attempt to drop paritioned table with
  foreign keys led to weird error messages and even crashes.
  
  The problem was that open_table_def() table which we have used to
  get list of names of foreign keys to be dropped along with table
  assumes that it can create handler object for table which definition
  it reads. For partitioning engine this step involves access to
  handler (.par) file and doesn't work if handler files are not
  around (i.e. if they already have been removed or missing), which
  is the case in code responsible for dropping tables. So attempt
  to call this function failed and misleading error message was
  emitted.
  
  This fix introduces fill_table_def_fk_list() function, which does not
  do full-blown table open and is used instead of open_table_def() to
  get list of foreign keys for table in code responsible for drop tables.
  
  Question for reviewer is marked by QQ.
[29 Apr 2008 8:34] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/46174

ChangeSet@1.2612, 2008-04-29 12:29:51+04:00, dlenev@mockturtle.local +7 -0
  Fix for bug #35529 "Foreign keys: crash dropping partitioned
  referenced table".
  
  In --foreign-key-all-engines mode attempt to drop paritioned table with
  foreign keys led to weird error messages and even crashes.
  
  The problem was that open_table_def() table which we have used to
  get list of names of foreign keys to be dropped along with table
  assumes that it can create handler object for table which definition
  it reads. For partitioning engine this step involves access to
  handler (.par) file and doesn't work if handler files are not
  around (i.e. if they already have been removed or missing), which
  is the case in code responsible for dropping tables. So attempt
  to call this function failed and misleading error message was
  emitted.
  
  This fix introduces fill_table_def_fk_list() function, which does not
  do full-blown table open and is used instead of open_table_def() to
  get list of foreign keys for table in code responsible for drop tables.
[29 Apr 2008 8:39] Dmitry Lenev
Fix for this bug was pushed into mysql-6.1-fk tree. Since this problem was reported against tree which is not publicly available yet I am simply closing this report.