Bug #71552 Manual is somewhat wrong/incomplete for innodb_force_recovery
Submitted: 1 Feb 2014 16:19 Modified: 21 Jul 2014 16:08
Reporter: Valeriy Kravchuk Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version:5.6 OS:Any
Assigned to: Daniel Price CPU Architecture:Any
Tags: innodb_force_recovery, missing manual

[1 Feb 2014 16:19] Valeriy Kravchuk
Description:
Manual describes innodb_force_recovery as enumeration at http://dev.mysql.com/doc/refman/5.6/en/innodb-parameters.html#sysvar_innodb_force_recovery. In reality it is unsigned integer. So, this part is somewhat wrong.

Later you can read:

"This restriction prohibits some queries that use WHERE or ORDER BY clauses, because high values can prevent queries from using indexes, to guard against possible corrupt index data."

It would be nice to see exact value starting from which secondary indexes are not allowed to be used. This part is incomplete. Probably this is value 4, but it's not really obvious from the code.

How to repeat:
You can check that it's actually integer either experimentally:

C:\Program Files\MySQL\MySQL Server 5.6\bin>mysqld.exe --help --verbose --innodb_force_recovery=8 >NUL
2014-02-01 18:01:08 1520 [Warning] Can't create test file C:\Program Files\MySQL
\MySQL Server 5.6\data\pc-PC.lower-test
2014-02-01 18:01:08 1520 [Warning] Can't create test file C:\Program Files\MySQL
\MySQL Server 5.6\data\pc-PC.lower-test
2014-02-01 18:01:08 1520 [Note] Plugin 'FEDERATED' is disabled.
2014-02-01 18:01:08 1520 [Warning] option 'innodb-force-recovery': unsigned valu
e 8 adjusted to 6
2014-02-01 18:01:11 1520 [Note] Binlog end
2014-02-01 18:01:11 1520 [Note] Shutting down plugin 'MyISAM'
2014-02-01 18:01:11 1520 [Note] Shutting down plugin 'CSV'

C:\Program Files\MySQL\MySQL Server 5.6\bin>echo %ERRORLEVEL%
0

(note warning above and the fact that there is no error for value 8)

or by checking the source code with:

grep -rn force_recovery * | grep -v mysql-test

You'll see:

...
storage/innobase/handler/ha_innodb.cc:15938:static MYSQL_SYSVAR_ULONG(force_recovery, srv_force_recovery,
storage/innobase/handler/ha_innodb.cc:15944:static MYSQL_SYSVAR_ULONG(force_recovery_crash, srv_force_recovery_crash,
...

Suggested fix:
Either document variable properly or change the code to correspond to the manual. Do not make unclear statements in the manual - try to explicitly list all values that trigger some change in behavior.
[4 Feb 2014 8:43] MySQL Verification Team
Hello Valeriy,

Thank you for the bug report.
Verified as described.

Thanks,
Umesh
[21 Jul 2014 16:08] Daniel Price
The innodb_force_recovery variable type has been changed from enumeration to numerical.

There is no code related to innodb_force_recovery that prevents the use of secondary indexes. The problematic information has been removed. 

The revised content should appear soon, with the next published documentation build. 

http://dev.mysql.com/doc/refman/5.6/en/innodb-parameters.html#sysvar_innodb_force_recovery
http://dev.mysql.com/doc/refman/5.6/en/forcing-innodb-recovery.html