Bug #29980 5.1.20 ate my table
Submitted: 23 Jul 2007 16:07 Modified: 3 Aug 2007 17:11
Reporter: Jim Winstead Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: MyISAM storage engine Severity:S1 (Critical)
Version:5.1.20/6.0 OS:Linux (Linux)
Assigned to: Ramil Kalimullin CPU Architecture:Any
Tags: corruption

[23 Jul 2007 16:07] Jim Winstead
Description:
Upon an upgrade to 5.1.20, the MySQL server reported the following for a CHECK TABLE on the table that will be attached (privately):

  Incorrect key file for table '<table>'; try to repair it

REPAIR TABLE did not correct the problem, and REPAIR TABLE ... USE_FRM fix the table but left it empty.

How to repeat:
Use the attached table with 5.1.20, try to CHECK it and REPAIR it.

The same table, restored on a system running 5.1.14, works fine.

Suggested fix:
Don't eat tables.
[23 Jul 2007 16:31] MySQL Verification Team
Thank you for the bug report. Verified with 5.1.21.
[24 Jul 2007 14:32] Jim Winstead
As the original report says, it was REPAIR TABLE ... USE_FRM that ate the contents.

mysql> show create table win32\G
*************************** 1. row ***************************
       Table: win32
Create Table: CREATE TABLE `win32` (
  `hash` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `address` varchar(255) NOT NULL DEFAULT '',
  KEY `h` (`hash`),
  KEY `a` (`address`(12))
) ENGINE=MyISAM DEFAULT CHARSET=latin1
1 row in set (0.00 sec)
[24 Jul 2007 15:17] Sergei Golubchik
a duplicate of Bug#28602, probably
[24 Jul 2007 16:17] MySQL Verification Team
Updating version.
[26 Jul 2007 8:07] 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/31596

ChangeSet@1.2577, 2007-07-26 13:07:01+05:00, ramil@mysql.com +1 -0
  Fix for bug #29980: 5.1.20 ate my table
  
  Problem: trying to repair an old (e.g. with "old" varstring fields) corrupted 
  table with use_frm option we don't actually repair the table, just altering it
  which may couse data loss.
  
  Fix: if use_frm repair option is set, do repair instead of altering even 
  if the table needs upgrade.
[2 Aug 2007 19:14] Bugs System
Pushed into 5.1.21-beta
[3 Aug 2007 17:11] Paul DuBois
Noted in 5.1.21 changelog.

REPAIR TABLE ... USE_FRM could corrupt tables.