| Bug #1502 | For set Query_Cache_size, there is no error Or warning from server | ||
|---|---|---|---|
| Submitted: | 8 Oct 2003 1:57 | Modified: | 5 Nov 2003 22:51 |
| Reporter: | Lokesh Babu | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Server | Severity: | S1 (Critical) |
| Version: | 4.x | OS: | All Operating Systems |
| Assigned to: | Oleksandr Byelkin | CPU Architecture: | Any |
[8 Oct 2003 14:17]
Oleksandr Byelkin
Thank you for bug report. But it is imposible to fix it in 4.0 (lack of warnings + 4.0 is freeze => big changes is not allowed) Following is for 4.1 ChangeSet 1.1579 03/10/09 00:13:15 bell@laptop.sanja.is.com.ua +26 -0 added worning about changing requested size of query cache (BUG#1502)
[26 Oct 2003 12:33]
Oleksandr Byelkin
Thank you for bugreport. Patch for this bug is pushed in source repository on MySQL 4.1 and will be present in next release.
[3 Nov 2003 1:36]
Lokesh Babu
I verified that changes are in the tree and test case (query_cache.result) also passes. But, when I set the query_cache_size from mysql monitor, defect is not yet fixed. I verified this on both Linux and NetWare. If I set query_cache_size to 1024 from mysql monitor, there is no error warning and the query_cache_size is still zero. Guess that, I am looking for correct behavior only.
[3 Nov 2003 12:34]
Oleksandr Byelkin
Which version of mysql you use? Does "mysql monitor" supports new protocol of 4.1 and warning in it?
[4 Nov 2003 0:15]
Lokesh Babu
Just to make sure, I again tried today on Redhat Linux 9.0. We pulled the code at 10 am (India time) today (11/3/2003) and built the binaries. Both MySQL server and MySQL monitor are running on the same Linux box. But, the behavior is still same. There is no warning to the client.
[4 Nov 2003 0:23]
Lokesh Babu
Sorry, I forgot to mention MySQL version in my last edit. It is 4.1.1-alpha. As I mentioned, code was pulled from bitkepper, today at 10 am (India time).
[4 Nov 2003 0:56]
Oleksandr Byelkin
As was found there are to things can be called "mysql monnitor" 1. web tool written in PHP 2. MySQL command line tool called 'mysql' Which one you mean? You use public repository which have some lag relative to our internal repository, are you sure that my bugfix is in your repository (check test suite for example)
[4 Nov 2003 1:42]
Lokesh Babu
By MySQL monitor, I mean command line tool 'mysql' shipped as part of MySQL binaries. I again verified that your fix is in public repository. Following is the snippet from query_cache.result file:
--------------------------------------------------------------------------------
set GLOBAL query_cache_size=1024;
Warnings:
Warning 1280 Query cache failed to set size 1024, new query cache size is 0
show global variables like "query_cache_size";
Variable_name Value
query_cache_size 0
-------------------------------------------------------------------------------
#define ER_WARN_QC_RESIZE 1279, is the new error code added in mysqld_error.h
Following is the snippet from set_var.cc
-------------------------------------------------------------------------------
static void fix_query_cache_size(THD *thd, enum_var_type type)
{
#ifdef HAVE_QUERY_CACHE
ulong requested= query_cache_size;
query_cache.resize(query_cache_size);
if (requested != query_cache_size)
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_WARN_QC_RESIZE, ER(ER_WARN_QC_RESIZE),
requested, query_cache_size);
#endif
}
-------------------------------------------------------------------------------
[4 Nov 2003 23:40]
Oleksandr Byelkin
Can you check thet you use mysql program from same distribution (to be sure that it can receive warning at all) (BTW, normally mysql show only number of warnings, you need issue additional command "show warning" to see them, only mysql-test do it automatically) Can you see other warnings?
[5 Nov 2003 22:07]
Lokesh Babu
Got it. Working with "show warnings" command. So, it looks like MySQL server is sending proper error message and it is up to client to handle the error in its own way

Description: There seems to be some bug with setting query_cache_size in mysql 4.0.x and 4.1.x. If we set the query cache size to less than SOME minimum value, query_cache_size is set to zero and query cache is disabled. But, no error or warning send to client, giving impression that everything is fine. Also, there is no documentation about, what is the MINIMUM size to be set for query cache. On my systems (NetWare and Windows), I tried with 32K and 48K. In these cases it is set to 0. But, it works fine, if it is set to 64K. I went through the code ( function Query_cache::init_cache in sql_cache.cc), but could not make out anything, as there are so many calculations. Though I tried it only on NetWare and Windows, defect is there on all the platforms. Search for "DBUG_PRINT("qcache", ("too small query cache => query cache disabled"));" in sql_cache.cc. If the hits this code, it returns without giving any error or warning. Here, there should be some warning Or error from MySQL server to client. How to repeat: 1. Start the server (4.0.x or 4.1.x), using mysqld_safe 2. From mysql monitor, set the query cache size using set GLOBAL query_cache_size=32000; 3. Query the variables using show variables like "query%"; Here it shows the query cache size as 0. But, there is no error/warning from server.