Bug #25347 Patch: mysqlcheck -A -r doesn't repair table marked as crashed
Submitted: 1 Jan 2007 15:20 Modified: 28 Jan 2008 17:19
Reporter: jocelyn fournier (Silver Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:5.0.44 OS:Linux (Linux, Windows)
Assigned to: CPU Architecture:Any
Tags: bfsm_2007_11_15, bfsm_2007_12_06, Contribution, qc

[1 Jan 2007 15:20] jocelyn fournier
Description:
Hi,

When a table is marked as crashed, mysqlcheck doesn't include it in the list of tables to check when -A or -B database option is used.

How to repeat:
Use the command

mysqlcheck -A -r 

where a database contains a table marked as crashed.

The table will be skipped, and hence not repaired.

Suggested fix:
Crashed tables should not be skipped.
[1 Jan 2007 15:53] Valeriy Kravchuk
Thank you for a bug report. Verified just as described, also on Windows. One possible set of steps to repeat:

1. In mysql:

use test;
create table tisam (c1 int auto_increment primary key, c2 char(100));
exit;

2. Make tisam.MYI empty (zero length) file.

3. Run:

mysqlcheck -uroot -p -r -B test

You will see that there will be now output for tisam table.

4. Connect using mysql command line client and try to repair using REPAIR. It will work (with USE_FRM option, at least).
[3 Mar 2007 0:02] jocelyn fournier
.
[3 Mar 2007 6:05] Sergei Golubchik
Jocelyn has a patch: http://lists.mysql.com/internals/34356
[7 Mar 2007 17:04] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/21383

ChangeSet@1.2421, 2007-03-07 11:40:04-05:00, cmiller@zippy.cornsilk.net +4 -0
  Patch contributed by Jocelyn Fournier.  CLA received 2007-02-27.
  
  Bug#25347: mysqlcheck -A -r doesn't repair table marked as crashed
  
  mysqlcheck tests nullness of the engine type to know whether the
  "table" is a view or not.  That also falsely catches tables that 
  are severly damaged.
  
  Instead, use SHOW CREATE VIEW to test whether a "table" is a view
  or not.
[7 Mar 2007 18:36] Jim Winstead
This patch is the wrong approach -- instead, process_all_tables_in_db() should use 'SHOW /*!50002 FULL*/ TABLES' and use the second column (if there is one) to decide if tables are views or not.
[7 Mar 2007 20:10] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/21422

ChangeSet@1.2421, 2007-03-07 15:13:24-05:00, cmiller@zippy.cornsilk.net +4 -0
  Patch contributed by Jocelyn Fournier.  CLA received 2007-02-27.
  
  Bug#25347: mysqlcheck -A -r doesn't repair table marked as crashed
  
  mysqlcheck tests nullness of the engine type to know whether the
  "table" is a view or not.  That also falsely catches tables that 
  are severly damaged.
  
  Instead, use SHOW FULL TABLES to test whether a "table" is a view
  or not.
  
  (Don't add new function.  Instead, get original data a smarter way.)
  ---
  Make it safe for use against databases before when views appeared.
[16 Apr 2007 19:00] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/24614

ChangeSet@1.2509, 2007-04-16 15:00:16-04:00, cmiller@zippy.cornsilk.net +2 -0
  Bug#25347: mysqlcheck -A -r doesn't repair table marked as crashed
  
  Additional changes to test:  "flush tables" so that Windows releases
  the files.
[23 Jan 2008 16:37] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/41159

ChangeSet@1.2563, 2008-01-23 11:37:46-05:00, cmiller@zippy.cornsilk.net +3 -0
  Patch contributed by Jocelyn Fournier.  CLA received 2007-02-27.
  
  Bug#25347: mysqlcheck -A -r doesn't repair table marked as crashed
  
  mysqlcheck tests nullness of the engine type to know whether the
  "table" is a view or not.  That also falsely catches tables that 
  are severly damaged.
  
  Instead, use SHOW FULL TABLES to test whether a "table" is a view
  or not.
  
  (Don't add new function.  Instead, get original data a smarter way.)
  
  Make it safe for use against databases before when views appeared.
[25 Jan 2008 23:00] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/41272

ChangeSet@1.2566, 2008-01-25 16:00:15-07:00, tsmith@ramayana.hindu.god +1 -0
  Un-break test case on Windows, for bug #25347
[27 Jan 2008 21:29] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/41289

ChangeSet@1.2567, 2008-01-27 14:28:50-07:00, tsmith@ramayana.hindu.god +2 -0
  Fix test case for Bug #25347 so that it actually tests the code fix,
  and so that it works correctly on Windows.
[28 Jan 2008 6:40] Bugs System
Pushed into 6.0.5-alpha
[28 Jan 2008 6:51] Bugs System
Pushed into 5.1.24-rc
[28 Jan 2008 6:51] Bugs System
Pushed into 5.0.56
[28 Jan 2008 17:19] Paul DuBois
Noted in 5.0.56, 5.1.24, 6.0.5 changelogs.

mysqlcheck -A -r did not correctly identify all tables that needed
repairing.
[6 Mar 2008 5:40] Jon Stephens
Also documented for 5.1.23-ndb-6.2.14.
[30 Mar 2008 0:25] Jon Stephens
Also documented for 5.1.23-ndb-6.3.11.
[6 May 2009 20:23] Bugs System
Pushed into 5.0.82 (revid:chad@mysql.com-20090506130632-s1cl4ygdj9rt2rrz) (version source revid:chad@mysql.com-20090506130632-s1cl4ygdj9rt2rrz) (merge vers: 5.0.82) (pib:6)