Bug #31463 Get error Wrong Bytesec error when Optimize Table
Submitted: 8 Oct 2007 19:04 Modified: 9 Nov 2007 1:11
Reporter: Clement Ho Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server: MyISAM storage engine Severity:S2 (Serious)
Version:5.1.21-beta-community OS:Windows (Windows 2003 x64)
Assigned to: CPU Architecture:Any
Tags: 5.1.21, Optimize

[8 Oct 2007 19:04] Clement Ho
Description:
The followings are what I did:
1. Create a table.
2. Insert data into the table from a CSV file. 
3. Delete some data from the table.
4. Optimize the table.
The error will showed up as the below stated. The table will be marked as crashed and need repair. And the repaire table is not working for me. So I have to drop the table and create the table again.
This problem doesn't happen to the 32-bit version of 5.1.21-beta which is also running on the 64-bit machine.

Optimization Error:
+----------------------+----------+----------+---------------------------------------------------------------------------------------------------------+
| Table                | Op       | Msg_type | Msg_text                                                                       |
+----------------------+----------+----------+---------------------------------------------------------------------------------------------------------+
| storydb.tbl_mainnews | optimize | info     | Wrong bytesec:   0-  0-  0 at 3488938108; Skipped                                                       |
| storydb.tbl_mainnews | optimize | error    | 5 when fixing table                                                                       |
| storydb.tbl_mainnews | optimize | Error    | Error on delete of 'C:\Program Files\MySQL\MySQL Server 5.1\Data\storydb\tbl_mainnews.MYD' (Errcode: 5) |
| storydb.tbl_mainnews | optimize | status   | Operation failed                                                                       |
+----------------------+----------+----------+---------------------------------------------------------------------------------------------------------+

The table structure is the following:
CREATE TABLE `tbl_mainnews` (
  `SID` varchar(24) CHARACTER SET latin1 COLLATE latin1_general_cs NOT NULL DEFAULT '',
  `OSID` varchar(24) DEFAULT '',
  `Accession` varchar(24) DEFAULT '',
  `Service` varchar(24) NOT NULL DEFAULT '',
  `Storytime` datetime NOT NULL DEFAULT '1973-01-01 00:00:00',
  `PCTime` datetime NOT NULL DEFAULT '1973-01-01 00:00:00',
  `RetentionDays` int(11) DEFAULT '90',
  `IsStoryAvailable` int(11) DEFAULT '0',
  `StoryLength` int(11) DEFAULT '0',
  `ComboLength` int(11) DEFAULT '0',
  `IsCompress` int(11) DEFAULT '0',
  `StoryType` int(11) DEFAULT '0',
  `FilePath` varchar(1024) DEFAULT '',
  `FileOffset` int(11) DEFAULT '0',
  `Symbols` varchar(1024) DEFAULT '',
  `Category` varchar(1024) DEFAULT '',
  `Headline` varchar(1024) NOT NULL DEFAULT '',
  `StoryBody` longtext,
  PRIMARY KEY (`SID`),
  KEY `idx_Storytime` (`Storytime`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1; 

How to repeat:
I could repeat the same problem repeat the same steps I mentioned above.
[8 Oct 2007 19:08] Sergey Petrunya
The query optimizer is not involved in OPTIMIZE TABLE. Changing category to MyISAM as the errors show up on MyISAM table.
[9 Oct 2007 1:11] MySQL Verification Team
Thank you for the bug report. Could you please provide a dump file with
enough insert statements to repeat the behavior reported?. Thanks in
advance.
[10 Nov 2007 0:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".