Bug #32635 Documentation does not explicitly state REPAIR upgrades a table
Submitted: 22 Nov 2007 22:47 Modified: 30 Nov 2007 12:04
Reporter: Pavel Pushkarev Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version:5.1, 5.0, 4.1 OS:Any
Assigned to: Jon Stephens CPU Architecture:Any

[22 Nov 2007 22:47] Pavel Pushkarev
Description:
A sequel to a false "not-a-bug" http://bugs.mysql.com/bug.php?id=32049

The documentation in 
http://dev.mysql.com/doc/refman/5.1/en/repair-table.html
does not explicitly say that a table can be upgraded with
REPAIR TABLE statement (although it is mentioned within the
text).

The mysql_upgrade utility http://dev.mysql.com/doc/refman/5.1/en/mysql-upgrade.html
uses this statement to actually upgrade the table.

How to repeat:
.
[25 Nov 2007 9:43] Sveta Smirnova
Thank you for the report.

Verified as described.

Additional explanation:

documentation says nothing about if REPAIR TABLE or mysql_upgrade or mysqlcheck should update version of table. This can lead to confusions.

For example testing indicated bug reports I get different output for different table versions:

mysql> show table status like 'su%'\G
*************************** 1. row ***************************
           Name: support_tickets
         Engine: MyISAM
        Version: 9
     Row_format: Dynamic
           Rows: 249752
 Avg_row_length: 120
    Data_length: 30038812
Max_data_length: 4294967295
   Index_length: 22960128
      Data_free: 0
 Auto_increment: 254611
    Create_time: 2007-10-11 01:30:07
    Update_time: 2007-11-25 10:22:51
     Check_time: 2007-10-11 01:30:36
      Collation: latin1_swedish_ci
       Checksum: NULL
 Create_options: 
        Comment: 
1 row in set (0.00 sec)

mysql> repair table support_tickets;
+----------------------+--------+----------+----------+
| Table                | Op     | Msg_type | Msg_text |
+----------------------+--------+----------+----------+
| test.support_tickets | repair | status   | OK       | 
+----------------------+--------+----------+----------+
1 row in set (15.70 sec)

mysql> show table status like 'su%'\G
*************************** 1. row ***************************
           Name: support_tickets
         Engine: MyISAM
        Version: 10
     Row_format: Dynamic
           Rows: 249752
 Avg_row_length: 119
    Data_length: 29750588
Max_data_length: 281474976710655
   Index_length: 27110400
      Data_free: 0
 Auto_increment: 254611
    Create_time: 2007-11-25 10:24:46
    Update_time: 2007-11-25 10:24:49
     Check_time: 2007-11-25 10:25:02
      Collation: latin1_swedish_ci
       Checksum: NULL
 Create_options: 
        Comment: 
1 row in set (0.00 sec)

mysql> show table status like 't1'\G
*************************** 1. row ***************************
           Name: t1
         Engine: MyISAM
        Version: 7
     Row_format: Fixed
           Rows: 2
 Avg_row_length: 5
    Data_length: 10
Max_data_length: 21474836479
   Index_length: 2048
      Data_free: 0
 Auto_increment: 3
    Create_time: 2007-08-21 22:52:25
    Update_time: 2007-11-25 10:38:14
     Check_time: NULL
      Collation: latin1_swedish_ci
       Checksum: NULL
 Create_options: 
        Comment: 
1 row in set (0.00 sec)

mysql> repair table t1;
+---------+--------+----------+----------+
| Table   | Op     | Msg_type | Msg_text |
+---------+--------+----------+----------+
| test.t1 | repair | status   | OK       | 
+---------+--------+----------+----------+
1 row in set (0.01 sec)

mysql> show table status like 't1'\G
*************************** 1. row ***************************
           Name: t1
         Engine: MyISAM
        Version: 7
     Row_format: Fixed
           Rows: 2
 Avg_row_length: 5
    Data_length: 10
Max_data_length: 21474836479
   Index_length: 2048
      Data_free: 0
 Auto_increment: 3
    Create_time: 2007-08-21 22:52:25
    Update_time: 2007-11-25 10:38:28
     Check_time: 2007-11-25 10:38:28
      Collation: latin1_swedish_ci
       Checksum: NULL
 Create_options: 
        Comment: 
1 row in set (0.00 sec)
[29 Nov 2007 18:56] Jon Stephens
If you're referring to this text:

<<Caution

Do not use USE_FRM if your table was created by a different version of the MySQL server than the one you are currently running. Doing so risks the loss of all rows in the table. It is particularly dangerous to use USE_FRM after the server returns this message:

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

All this means is that you've tried to do a repair with USE_FRM, and it failed; you should run the REPAIR TABLE again without the USE_FRM option.

In addition, I see nothing in the description of mysql_upgrade to support the claim that it uses REPAIR TABLE.
[30 Nov 2007 11:38] Jon Stephens
Discussing with Sveta and Sergei.
[30 Nov 2007 11:38] Jon Stephens
Marked Bug #32049 as a duplicate of this one.
[30 Nov 2007 12:04] Jon Stephens
Thank you for your bug report. This issue has been addressed in the documentation. The updated documentation will appear on our website shortly, and will be included in the next release of the relevant products.

Added the following to the REPAIR TABLE section:

          If USE_FRM is not used, then a CHECK TABLE ... FOR UPGRADE
          statement is automatically run as part of the REPAIR TABLE. See 
          "CHECK TABLE Syntax" for more information.