Bug #45475 TABLE_OPEN_CACHE_MIN should be same value as TABLE_OPEN_CACHE_DEFAULT
Submitted: 12 Jun 2009 19:03 Modified: 21 Jul 2009 20:41
Reporter: Vincent Carbone
Status: Closed
Category:Server: Options Severity:S5 (Performance)
Version:5.4.0-Beta OS:Sun Solaris (snv_106 X86)
Assigned to: Mikael Ronstrom Target Version:5.4.2+
Tags: TABLE_OPEN_CACHE_DEFAULT, TABLE_OPEN_CACHE_MIN, table_open_cache, 5.4-Beta
Triage: Triaged: D2 (Serious)

[12 Jun 2009 19:03] Vincent Carbone
Description:
In MySQL 5.4-Beta TABLE_OPEN_CACHE_DEFAULT was increased from 64 to 400 to reduce
contention on the table cache. TABLE_OPEN_CACHE_MIN was not increased also. The impact of
this occurs in init_common_variables in sql/mysqld.cc. If less file handles than were
explicity requested cannot be satisfied max_connections and table_open_cache will be
recalculated. table_open_cache will be decreased but not below TABLE_OPEN_CACHE_MIN.
Currently that means table_open_cache can be resized down to the old default of 64.

How to repeat:
This condition was found on Solars (snv_106 X86) but probably applies to Unix and Linux
in general.

1. login as mysql (or a non-root user that does not have privilege to increase hard
resource limits)

2. Set table_open_cache=4096 and max_connections=2049

3. From the command shell set the soft and hard file descriptor limit to 1024
# ulimit -n 1024

4. mysqld_safe &

5. Check error log:
090611 10:52:09 [Warning] Changed limits: max_open_files: 1024  max_connections: 886 
table_cache: 64

Suggested fix:
In client/mysql_priv.h:
-- #define TABLE_OPEN_CACHE_MIN    64
++ :#define TABLE_OPEN_CACHE_MIN  400

In sql/mysql_priv.h:
-- #define TABLE_OPEN_CACHE_MIN    64
++ :#define TABLE_OPEN_CACHE_MIN  400
[13 Jun 2009 14:00] Valeriy Kravchuk
Thank you for the problem report.
[2 Jul 2009 18:06] Mikael Ronstrom
Set TABLE_OPEN_CACHE_MIN (64 before) and TABLE_DEFAULT_CACHE_MIN (256 before) to 400
[6 Jul 2009 16:45] Trudy Pelzer
Pushed to 5.4.2 on July 2/2009
[21 Jul 2009 20:41] Paul DuBois
Noted in 5.4.2 changelog.

The minimum value for table_open_cache was increased from 64 to 400.