Bug #91806 Explicitly setting thread_cache_size=-1 (autosizing) doesn't work
Submitted: 26 Jul 2018 15:41 Modified: 30 Jul 2018 7:26
Reporter: lalit Choudhary Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.6,5.7,8.0 OS:Any
Assigned to: CPU Architecture:Any
Tags: thread_cache_size

[26 Jul 2018 15:41] lalit Choudhary
Description:
setting "thread-cache-size=-1" in my.cnf which should cause an automatic value for thread_cache_size according to http://dev.mysql.com/doc/refman/5.6/en/server-system-variables.html#sysvar_thread_cache_si...

However when set to "-1":

mysql> SHOW VARIABLES LIKE "thread_cache_size";
+-------------------+-------+
| Variable_name | Value |
+-------------------+-------+
| thread_cache_size | 0 |
+-------------------+-------+
1 row in set (0.00 sec)

How to repeat:
Steps: 
1. Add "thread-cache-size=-1" in my.cnf
2. Restart mysqld server
3. execute SHOW VARIABLES LIKE "thread_cache_size";

Expected value should be -1 as per my.cnf setting, but it showing value as 0.

mysql> SHOW VARIABLES LIKE "thread_cache_size";
+-------------------+-------+
| Variable_name | Value |
+-------------------+-------+
| thread_cache_size | 0 |
+-------------------+-------+
1 row in set (0.00 sec)

Suggested fix:
It should show value as -1, configured value as per my.cnf settings.
[27 Jul 2018 2:17] Miguel Solorzano
Thank you for the bug report. What the Manual says is exactly you don't assign -1.

-1 (signifies autosizing; do not assign this literal value)
[27 Jul 2018 3:14] lalit Choudhary
Hi Miguel,

In this case user should not allow to set -1 value explicitly and even if it is allowing it for some reasons at least it should log this change as warning/note in MySQL server log.
[27 Jul 2018 10:48] lalit Choudhary
Above ask may be a feature request?
[30 Jul 2018 7:11] lalit Choudhary
In this case, user should not allow to set -1 value explicitly and even if it is allowing it for some reasons at least it should log this change as warning/note in MySQL server log.

Above ask may be a feature request?
[30 Jul 2018 7:26] lalit Choudhary
In this case, user should not allow to set -1 value explicitly and even if it is allowing it for some reasons at least it should log this change as warning/note in MySQL server log.
Above ask may be a feature request?