Bug #30152 MySQLD crash duing alter table causes DROP DATABASE to FAIL due to temp file
Submitted: 31 Jul 2007 16:09 Modified: 24 Jan 2008 20:02
Reporter: Jonathan Miller Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.1-bk mysql-5.1-telco-6.2 OS:Linux (32 Bit)
Assigned to: Sergei Glukhov CPU Architecture:Any

[31 Jul 2007 16:09] Jonathan Miller
Description:
During on-line alter table add column, if the MySQLD crashes during a temp file is left in the database directory. (i.e. #sql-347f_6.frm)

When you issues a DROP DATABASE it fails with:

DBD::mysql::st execute failed: Error dropping database (can't rmdir './TABLE_ALTER', errno: 39) at ./ndb_alter_dd.pl line 362.
DBD::mysql::st execute failed: Error dropping database (can't rmdir './TABLE_ALTER', errno: 39) at ./ndb_alter_dd.pl line 362.

This is due to the temp file #sql-347f_6.frm. All information is deleted with exception of the directory and temp file. This can cause later create database to fail

How to repeat:
Create a file in a database directory called #sql-347f_6.frm
Try to DROP that database

Suggested fix:
Database should drop even if temp file exists
#sql-347f_6.frm
[31 Jul 2007 16:10] Jonathan Miller
This was found due to http://bugs.mysql.com/bug.php?id=30149
[23 Nov 2007 9:59] 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/38339

ChangeSet@1.2611, 2007-11-23 13:54:19+04:00, gluh@mysql.com +3 -0
  Bug#30152 MySQLD crash duing alter table causes DROP DATABASE to FAIL due to temp file
  disable decoding of table name if the table is internal temporary table
[23 Nov 2007 11:06] 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/38341

ChangeSet@1.2612, 2007-11-23 15:00:22+04:00, gluh@mysql.com +5 -0
  Bug#30152 MySQLD crash duing alter table causes DROP DATABASE to FAIL due to temp file
  disable decoding of table name if the table is internal temporary table
[23 Nov 2007 11:31] Alexander Barkov
http://lists.mysql.com/commits/38341 is ok.

Before pushing, please add these two lines into the test:

create table mysql_test.`#sql-347f_8` (f1 int);
drop table mysql_test.`#sql-347f_8`;

To make sure that "normal" tables with this prefix work fine.
[23 Nov 2007 14:27] 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/38376

ChangeSet@1.2644, 2007-11-23 18:21:24+04:00, gluh@mysql.com +5 -0
  Bug#30152 MySQLD crash duing alter table causes DROP DATABASE to FAIL due to temp file
  disable decoding of table name if the table is internal temporary table
[26 Nov 2007 9:02] 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/38479

ChangeSet@1.2649, 2007-11-26 12:56:31+04:00, gluh@mysql.com +1 -0
  Bug#30152 MySQLD crash duing alter table causes DROP DATABASE to FAIL due to temp file(addon)
  result fix
[14 Dec 2007 8:16] Bugs System
Pushed into 5.1.23-rc
[14 Dec 2007 8:20] Bugs System
Pushed into 6.0.5-alpha
[24 Jan 2008 20:02] Paul DuBois
Noted in 5.1.23, 6.0.5 changelogs.

If the server crashed during an ALTER TABLE statement, leaving a
temporary file in the database directory, a subsequent DROP DATABASE 
statement failed due to the presence of the temporary file.