Bug #11 REPAIR ... USE_FRM; corrupts table under Windows
Submitted: 2 Dec 2002 21:07 Modified: 21 Dec 2002 8:42
Reporter: Alexander Keremidarski Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.0.5 and above OS:Windows (Windows2000)
Assigned to: MySQL Verification Team CPU Architecture:Any

[2 Dec 2002 21:07] Alexander Keremidarski
Description:
Win2000 Sp3
NTFS

MySQL-4.0.5

When trying to repair tables with using REPAIR TABLE tbl USE_FRM; syntax REPAIR fails with error message and leaves table in corrupted state as well as temporary file with old content

How to repeat:
mysql> CREATE TABLE t (t int);
Query OK, 0 rows affected (0.06 sec)
mysql> INSERT t VALUES(1);
Query OK, 1 row affected (0.00 sec)
mysql> REPAIR TABLE t USE_FRM;
+---------+--------+----------+------------------------------------+
| Table   | Op     | Msg_type | Msg_text                           |
+---------+--------+----------+------------------------------------+
| TBGv2.t | repair | error    | Failed renaming .MYD file          |
+---------+--------+----------+------------------------------------+

At this point:
t.MYD is 0 bytes

There is old .MYD left with temp name like:
t.MYD-270_2
[21 Dec 2002 8:42] MySQL Developer
Fixed in 4.0.6