Bug #126 REPAIR TABLE does not update checksum information
Submitted: 6 Mar 2003 1:44 Modified: 22 Apr 2003 7:03
Reporter: Peter Zaitsev (Basic Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.0 OS:Linux (Linux)
Assigned to: Alexey Botchkov CPU Architecture:Any

[6 Mar 2003 1:44] Peter Zaitsev
Description:
REPAIR table seems not to update checksum of the table, which lead to table corruption reported by CHECK TABLE followed repair table:

How to repeat:
create table crash(i int) checksum=1;
insert into crash values(1);

Now lets crash table by doing the following on console:

echo . > crash.MYD

mysql> check table crash;
+------------+-------+----------+---------------------------------------------+
| Table      | Op    | Msg_type | Msg_text                                    |
+------------+-------+----------+---------------------------------------------+
| test.crash | check | error    | Size of datafile is: 2         Should be: 6 |
| test.crash | check | error    | Corrupt                                     |
+------------+-------+----------+---------------------------------------------+
2 rows in set (0.25 sec)

mysql> repair table crash;
+------------+--------+----------+------------------------------------+
| Table      | Op     | Msg_type | Msg_text                           |
+------------+--------+----------+------------------------------------+
| test.crash | repair | warning  | Number of rows changed from 1 to 0 |
| test.crash | repair | status   | OK                                 |
+------------+--------+----------+------------------------------------+
2 rows in set (0.32 sec)

mysql> check table crash;
+------------+-------+----------+-----------------------------------------------------------------------+
| Table      | Op    | Msg_type | Msg_text                                                              |
+------------+-------+----------+-----------------------------------------------------------------------+
| test.crash | check | warning  | Record checksum is not the same as checksum stored in the index file
 |
| test.crash | check | error    | Corrupt                                                               |
+------------+-------+----------+-----------------------------------------------------------------------+
2 rows in set (0.00 sec)

mysql>
[22 Apr 2003 7:03] Alexey Botchkov
Thank you for your bug report. This issue has been fixed in the latest
development tree for that product. You can find more information about
accessing our development trees at 
    http://www.mysql.com/doc/en/Installing_source_tree.html

Fixed in 4.0 tree