Bug #22239 Query cache too big, reset to zero: throw error, rather than issue warning
Submitted: 11 Sep 2006 14:27 Modified: 7 Jul 2017 9:13
Reporter: Stefan Hinz Email Updates:
Status: Won't fix Impact on me:
None 
Category:MySQL Server: Query Cache Severity:S4 (Feature request)
Version:all OS:Any (all)
Assigned to: CPU Architecture:Any

[11 Sep 2006 14:27] Stefan Hinz
Description:
When we set the query cache size too high (probably >= 4G), the cache is reset to zero, that is, it will be disabled.
There is a warning, but I think we should rather throw an error and refuse to change the size of the query cache.
After all, what the user intends to do is increase the size, not disable the cache.

How to repeat:
mysql> SHOW VARIABLES LIKE 'query_cache_size';
+------------------+---------+
| Variable_name    | Value   |
+------------------+---------+
| query_cache_size | 1048576 |
+------------------+---------+
1 row in set (0.00 sec)

mysql> SET GLOBAL query_cache_size=1024*1024*1024*4;
Query OK, 0 rows affected, 1 warning (0.00 sec)

Warning (Code 1282): Query cache failed to set size 4294966272; new query cache size is 0
mysql> SHOW VARIABLES LIKE 'query_cache_size';
+------------------+-------+
| Variable_name    | Value |
+------------------+-------+
| query_cache_size | 0     |
+------------------+-------+
1 row in set (0.00 sec)

mysql>                                    

Suggested fix:
Throw an error, rather than issuing a warning. Refuse to change the size of the query cache.
[11 Sep 2006 16:12] Valeriy Kravchuk
Thank you for a reasonable feature request.
[26 Jan 2009 14:03] Mattias Jonsson
bug#20988 is related.
[7 Jul 2017 9:13] Erlend Dahl
MySQL will no longer invest in the query cache, see:

http://mysqlserverteam.com/mysql-8-0-retiring-support-for-the-query-cache/