Bug #41272 ALTER TABLE REBUILD PARTITION doesn't cleanup on failure
Submitted: 5 Dec 2008 22:17 Modified: 15 Feb 2009 20:29
Reporter: Baron Schwartz (Basic Quality Contributor) Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server: Partitions Severity:S2 (Serious)
Version:5.1.21-beta-log OS:Any
Assigned to: CPU Architecture:Any
Tags: qc

[5 Dec 2008 22:17] Baron Schwartz
Description:
REBUILD PARTITION leaves behind its temp files if the partition is crashed.

How to repeat:
I thought I would try to repair a table without locking the whole thing, so I used REBUILD PARTITION.

Actually, I first tried REPAIR PARTITION, knowing fully well that it would fail.  See bug #20129.  Then I said

mysql> alter table foo.Subscribers rebuild partition pMM;
ERROR 1194 (HY000): Table 'Subscribers' is marked as crashed and should be repaired

That took a really long time.  In the meanwhile I was able to see the new files being built.  And then they were left behind after the operation failed.

Fri Dec  5 13:47:46 PST 2008
-rw-rw---- 1 mysql mysql 916401152 Dec  5 13:26 Subscribers#P#pMM.MYI
-rw-rw---- 1 mysql mysql 544328704 Dec  5 13:26 Subscribers#P#pMM#TMP#.MYI
-rw-rw---- 1 mysql mysql 729833564 Dec  5 13:26 Subscribers#P#pMM#TMP#.MYD
-rw-rw---- 1 mysql mysql 900718164 Dec  5 11:55 Subscribers#P#pMM.MYD
[8 Dec 2008 8:40] Sveta Smirnova
Thank you for the report.

But version 5.1.21 is old. Please try with current version 5.1.30 and if problem still exists provide repeatable test case.
[8 Dec 2008 13:43] Baron Schwartz
Unfortunately this is on a customer's server, and I can't just upgrade it.  If I get time in my spare time, I will try to build a reproduceable test case on 5.1.30, but that is not what I'm paid to do and I'm working long days.  Perhaps in the meantime you will be able to do that so this bug doesn't just sit with no activity.
[8 Dec 2008 15:24] Mattias Jonsson
This might be related to bug#30102.
[10 Dec 2008 14:01] Miguel Solorzano
Please see last comment regarding rename table, this behavior still exist in source server:

miguel@hegel:~/dbs$ ls 5.1/var/test/
db.opt  t2.frm  t2.par  t2#P#p0.MYD  t2#P#p0.MYI  t2#P#p1xxxxxxxxxx.MYD  t2#P#p1xxxxxxxxxx.MYI
miguel@hegel:~/dbs$
[11 Jan 2009 0:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[15 Jan 2009 20:29] Miguel Solorzano
Do you think it is same case of: http://bugs.mysql.com/bug.php?id=30102.
Thanks in advance.
[16 Feb 2009 0:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".