Bug #34563 open_files_limit calculation wrong in manual
Submitted: 14 Feb 2008 19:11 Modified: 16 Jun 2008 15:49
Reporter: Kyle Joiner Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version:5.0 OS:Any
Assigned to: Paul DuBois CPU Architecture:Any

[14 Feb 2008 19:11] Kyle Joiner
Description:
The Manual states:
Change the number of file descriptors available to mysqld. If this option is not set or is set to 0, mysqld uses the value to reserve file descriptors with setrlimit(). If the value is 0, mysqld reserves max_connections×5 or max_connections + table_open_cache×2 files (whichever is larger). You should try increasing this value if mysqld gives you the error Too many open files.

Where the code says:
2742 
2743     /* MyISAM requires two file handles per table. */
2744     wanted_files= 10+max_connections+table_cache_size*2;
2745     /*
2746       We are trying to allocate no less than max_connections*5 file
2747       handles (i.e. we are trying to set the limit so that they will
2748       be available).  In addition, we allocate no less than how much
2749       was already allocated.  However below we report a warning and
2750       recompute values only if we got less file handles than were
2751       explicitly requested.  No warning and re-computation occur if we
2752       can't get max_connections*5 but still got no less than was
2753       requested (value of wanted_files).
2754     */
2755     max_open_files= max(max(wanted_files, max_connections*5),
2756                         open_files_limit);
2757     files= my_set_max_open_files(max_open_files);
2758 

The code indicates a different calculation than the manual shows and that the comparison does not look at it being set to 0 to perform calculation.

How to repeat:
look at code versus manual.

Suggested fix:
verify which is correct and correct manual if necessary.
[15 Feb 2008 16:10] Konstantin Osipov
The code is correct, docs should be updated.
Or rather, I wonder why we need to document the exact formula?
It may change as the server gets new modules and starts using more open files.
[16 Jun 2008 15:49] Paul DuBois
Thank you for your bug report. This issue has been addressed in the documentation. The updated documentation will appear on our website shortly, and will be included in the next release of the relevant products.