Bug #18129 Fast (online) add index leaves temporary table frm in case of errors
Submitted: 10 Mar 2006 10:28 Modified: 27 Apr 2006 13:43
Reporter: Martin Skold Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:5.1.8 OS:
Assigned to: Ingo Strüwing CPU Architecture:Any

[10 Mar 2006 10:28] Martin Skold
Description:
CREATE TABLE t1 (
  a int NOT NULL PRIMARY KEY,
  b int not null,
  c int)
engine = ndbcluster;
insert t1 values(1, 2, 3), (2, 2, 4);
--error 1169
create unique index ib on t1(b);

How to repeat:
Run above sequence and check what frm files are on disk

Suggested fix:
Clean up frm files in error handling in mysql-alter-table
[13 Apr 2006 14:18] Ingo Strüwing
My test file.

Attachment: bug18129.test (application/octet-stream, text), 406 bytes.

[13 Apr 2006 14: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/4923
[26 Apr 2006 12:44] Ingo Strüwing
ALTER TABLE temporarily creates a new table with a .frm
  file and optionally other files. For fast ALTER TABLE
  only the .frm file is created. If the operation succeeds,
  The temporary files are renamed to their final target.
  
  In case of an error, the temporary file was forgotten to
  remove.
  
  Manually tested. The test requires to look at files,
  which I think cannot be done portably with the test suite.
  The test file is attached to the bug report.

Pushed to 5.1.10.
[27 Apr 2006 13:43] Paul Dubois
Noted in 5.1.10 changelog.

A failed <literal>ALTER TABLE</literal> operation could fail
to clean up a temporary <filename>.frm</filename> file. (Bug
#18129)