Bug #32636 MySQL server doesn't upgrade MyISAM tables
Submitted: 22 Nov 2007 22:50 Modified: 8 Dec 2007 17:43
Reporter: Pavel Pushkarev Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: MyISAM storage engine Severity:S3 (Non-critical)
Version:5.1.22-rc OS:Any
Assigned to: CPU Architecture:Any

[22 Nov 2007 22:50] Pavel Pushkarev
Description:
А sequel to bugs
http://bugs.mysql.com/bug.php?id=32635
http://bugs.mysql.com/bug.php?id=32049

The 32049 bug was said to be a not-a-bug, but actually it is.

How to repeat:
1. Get a binary MyISAM table from 4.0 (version 7) into MySQL 5.1 datadir.
2. Issue a REPAIR TABLE statement or use mysql_upgrade --repair.

The table does not get upgraded to version 10.
[23 Nov 2007 8:32] Sveta Smirnova
Thank you for the report.

But why you decided version of table should be upgraded?
[23 Nov 2007 11:57] Pavel Pushkarev
First of all, it does get upgraded in 5.0 version of MySQL.
Also, the server itself suggests the upgrade with the following statement
(which is also mentioned in http://dev.mysql.com/doc/refman/5.0/en/repair-table.html):

Table upgrade required. Please do
"REPAIR TABLE `tbl_name`" to fix it!

Unfortunately, the 5.1 version does not upgrade 4.0 tables and that is the bug.
[23 Nov 2007 12:28] Grigory Rubtsov
Also Upgrade documentation says:
http://dev.mysql.com/doc/refman/5.1/en/upgrading-from-5-0.html

>> To avoid problems due to such changes, after you upgrade to a new version of MySQL, you should run mysql_upgrade to check your tables (and repair them if necessary).

Without repair working there is no other way to upgrade tables. Being in old format they may be incompatible with functionality of 5.1 and eventually broken.
[25 Nov 2007 9:40] Sveta Smirnova
Thank you for the feedback.

You seems to be right: some functionality of REPAIR TABLE is broken in last versions.

Please indicate accurate version of MySQL 5.0 where REPAIR TABLE worked as you expected.
[25 Nov 2007 11:32] Pavel Pushkarev
The 5.0 MySQL branch looks like it doesn't have the bug at all.

I have just checked it with the BK version of 5.0 (which reports itself as 5.0.54) 
- the table gets upgraded as expected.
[30 Nov 2007 11:09] Sveta Smirnova
Thank you for the feedback.

As you can see in my example to bug #32636 REPAIR TABLE updates version only if upgrade is needed and USE_FRM was not specified and left version number untouched if upgrade is not needed.

So, please, provide table (*MYD, *.MYI and *.frm files) which MySQL 5.0 decides to upgrade, but  MySQL 5.1 decides not to upgrade.
[30 Nov 2007 13:15] Pavel Pushkarev
frm file

Attachment: a.frm (application/x-maker, text), 8.37 KiB.

[30 Nov 2007 13:15] Pavel Pushkarev
MYD file

Attachment: a.MYD (application/octet-stream, text), 40 bytes.

[30 Nov 2007 13:15] Pavel Pushkarev
MYI file

Attachment: a.MYI (application/octet-stream, text), 2.00 KiB.

[4 Dec 2007 20:33] Sveta Smirnova
Thank you for the feedback.

With provided table I see next:

mysql> flush tables;
Query OK, 0 rows affected (0.00 sec)

mysql> show table status like 'a'\G
*************************** 1. row ***************************
           Name: a
         Engine: NULL
        Version: NULL
     Row_format: NULL
           Rows: NULL
 Avg_row_length: NULL
    Data_length: NULL
Max_data_length: NULL
   Index_length: NULL
      Data_free: NULL
 Auto_increment: NULL
    Create_time: NULL
    Update_time: NULL
     Check_time: NULL
      Collation: NULL
       Checksum: NULL
 Create_options: NULL
        Comment: Incorrect key file for table 'a'; try to repair it
1 row in set (0.00 sec)

like in bug #31331. Do you see another results?
[7 Dec 2007 21:50] Pavel Pushkarev
Yes, this looks to be the same bug. Probably MySQL 5.1
does not support old 4.0 tables at all?
[8 Dec 2007 17:43] Sveta Smirnova
Thank you for the feedback.

Closed as duplicate of bug #31331. Please subscribe to that bug to follow the topic.