Bug #28604 innodb_force_recovery restricts data dump
Submitted: 22 May 2007 21:47 Modified: 4 Feb 2008 19:33
Reporter: Peter Zaitsev (Basic Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S3 (Non-critical)
Version:5.0.41, 5.1, 4.1 OS:Any
Assigned to: Inaam Rana
Tags: qc, regression
Triage: D2 (Serious)

[22 May 2007 21:47] Peter Zaitsev
Description:
Using innodb_force_recovery=4 option blocks ability to dump the table:

mysql> select * from link_in66 limit 5;
ERROR 1034 (HY000): Incorrect key file for table 'link_in66'; try to repair it

I've checked version 5.0.33 it still has the same issue, version 5.0.22 however does not. 

How to repeat:
Se above.
[23 May 2007 8:14] Sveta Smirnova
Thank you for the report.

Verified as described.
[23 May 2007 8:20] Sveta Smirnova
Bug has been introduced in 5.0.33
[23 May 2007 12:12] Heikki Tuuri
This looks like a bad bug.
[23 May 2007 12:29] Heikki Tuuri
MySQL probably has changed the error handling of ::info() calls.

ha_innodb.cc in 5.0:

/*************************************************************************
Returns statistics information of the table to the MySQL interpreter,
in various fields of the handle object. */

int
ha_innobase::info(
/*==============*/
        uint flag)      /* in: what information MySQL requests */
{
        row_prebuilt_t* prebuilt        = (row_prebuilt_t*) innobase_prebuilt;
        dict_table_t*   ib_table;
        dict_index_t*   index;
        ha_rows         rec_per_key;
        ib_longlong     n_rows;
        ulong           j;
        ulong           i;
        char            path[FN_REFLEN];
        os_file_stat_t  stat_info;

        DBUG_ENTER("info");

        /* If we are forcing recovery at a high level, we will suppress
        statistics calculation on tables, because that may crash the
        server if an index is badly corrupted. */

        if (srv_force_recovery >= SRV_FORCE_NO_IBUF_MERGE) {

                DBUG_RETURN(HA_ERR_CRASHED);
        }

###############

A probable fix:

return 0 above, instead of HA_ERR_CRASHED.

Assigning this to Inaam.
[2 Aug 2007 19:12] Bugs System
Pushed into 5.1.21-beta
[1 Feb 2008 19:19] Timothy Smith
Docs team: fixed in 5.0.48.
[4 Feb 2008 19:33] Paul Dubois
Noted in 5.0.48, 5.1.21 changelogs.

Starting the server with an innodb_force_recovery value of 4 did not work.