Bug #28414 please add more useful information to error logs when corruption occurs
Submitted: 14 May 2007 12:40 Modified: 23 Oct 2007 11:09
Reporter: Shane Bester (Platinum Quality Contributor) Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: MyISAM storage engine Severity:S4 (Feature request)
Version:5.0.x, 5.1.x OS:Any
Assigned to: Assigned Account CPU Architecture:Any
Tags: bfsm_2007_05_31, bfsm_2007_06_21, bfsm_2007_06_28, corruption, myisam

[14 May 2007 12:40] Shane Bester
Description:
When a myisam table becomes corrupted, mysql usually writes something like this to error log:

070514  9:43:48 [ERROR] mysqld-debug: Incorrect key file for table '.\test\t1.MYI'; try to repair it

However, this is not enough information.  
We require more useful errors, because these corruptions are
often a result of a mysql bug.

Some errors where we need the information are:
error 134, 127, 124, 126

How to repeat:
view error log and try determine a cause of table corruption.

Suggested fix:
The developers should add more information that can help them locate a cause of corruption.

Some ideas from me that could appear in error logs:

1) current running query which caused/found the corruption
2) current threads reading/writing from that table can be printed
3) the function/source code file in which the error originate can be printed.
4) dump the current processlist?
5) ... other ideas?

We need these to be included in the release version of mysql.
[15 May 2007 11:10] Valeriy Kravchuk
Thank you for a problem report.
[18 May 2007 16:09] MySQL Verification Team
See example of bug #27510 where more information is needed.
[19 May 2007 9:07] MySQL Verification Team
bug #28154 and #27510 classic examples of why we need better errors in the logs.
[29 May 2007 21:18] MySQL Verification Team
A good start could be to convert some DBUG_PRINT messages to fprintf so that would show up in a error log?

<cut>
 my_errno= HA_ERR_WRONG_IN_RECORD;
  DBUG_PRINT("error",("to_end: 0x%lx -> 0x%lx  from_end: 0x%lx -> 0x%lx",
		      (long) to, (long) to_end, (long) from, (long) from_end));
  DBUG_DUMP("from",(byte*) info->rec_buff,info->s->base.min_pack_length);
  DBUG_RETURN(MY_FILE_ERROR);

..

 DBUG_PRINT("error",("Delete link crashed"));

..

DBUG_PRINT("error",("Got wrong block info"));

..

DBUG_PRINT("error",("to_end: 0x%lx -> 0x%lx  from_end: 0x%lx -> 0x%lx",
		      (long) to, (long) to_end, (long) from, (long) from_end));
..

etc,
[29 May 2007 21:24] MySQL Verification Team
if an innodb corruption occurs in innodb, we can normally make a good diagnosis from the error log and assertions of a probable cause.

not so with myisam!  we need that greater level of diagnostics.  even innodb still has bugs with corruption today, but the reason we found them was due to assertions....
[23 Oct 2007 11:09] Sergey Vojtovich
A duplicate of WL#3951.