Commit 5c8124bd authored by unknown's avatar unknown

fixed query cahe resize bug


mysql-test/r/query_cache.result:
  query cache resize bug test
mysql-test/t/query_cache.test:
  query cache resize bug test
sql/set_var.cc:
  typo fixed
sql/sql_cache.cc:
  prevent of using very small (unusable) cache size, that cause problem in memory allocation system (query cache resize bug)
parent 0e43c436
...@@ -490,3 +490,19 @@ drop table t1; ...@@ -490,3 +490,19 @@ drop table t1;
show status like "Qcache_queries_in_cache"; show status like "Qcache_queries_in_cache";
Variable_name Value Variable_name Value
Qcache_queries_in_cache 0 Qcache_queries_in_cache 0
set GLOBAL query_cache_size=1000;
show global variables like "query_cache_size";
Variable_name Value
query_cache_size 0
set GLOBAL query_cache_size=1100;
set GLOBAL query_cache_size=1200;
set GLOBAL query_cache_size=1300;
set GLOBAL query_cache_size=1400;
set GLOBAL query_cache_size=1500;
set GLOBAL query_cache_size=1600;
set GLOBAL query_cache_size=1700;
set GLOBAL query_cache_size=1800;
set GLOBAL query_cache_size=1900;
show global variables like "query_cache_size";
Variable_name Value
query_cache_size 1024
...@@ -336,3 +336,19 @@ select a from t1; ...@@ -336,3 +336,19 @@ select a from t1;
show status like "Qcache_queries_in_cache"; show status like "Qcache_queries_in_cache";
drop table t1; drop table t1;
show status like "Qcache_queries_in_cache"; show status like "Qcache_queries_in_cache";
#
# Test of query cache resizing
#
set GLOBAL query_cache_size=1000;
show global variables like "query_cache_size";
set GLOBAL query_cache_size=1100;
set GLOBAL query_cache_size=1200;
set GLOBAL query_cache_size=1300;
set GLOBAL query_cache_size=1400;
set GLOBAL query_cache_size=1500;
set GLOBAL query_cache_size=1600;
set GLOBAL query_cache_size=1700;
set GLOBAL query_cache_size=1800;
set GLOBAL query_cache_size=1900;
show global variables like "query_cache_size";
...@@ -467,7 +467,7 @@ struct show_var_st init_vars[]= { ...@@ -467,7 +467,7 @@ struct show_var_st init_vars[]= {
{sys_read_buff_size.name, (char*) &sys_read_buff_size, SHOW_SYS}, {sys_read_buff_size.name, (char*) &sys_read_buff_size, SHOW_SYS},
{sys_read_rnd_buff_size.name,(char*) &sys_read_rnd_buff_size, SHOW_SYS}, {sys_read_rnd_buff_size.name,(char*) &sys_read_rnd_buff_size, SHOW_SYS},
{sys_rpl_recovery_rank.name,(char*) &sys_rpl_recovery_rank, SHOW_SYS}, {sys_rpl_recovery_rank.name,(char*) &sys_rpl_recovery_rank, SHOW_SYS},
#ifdef HAVE_QUERTY_CACHE #ifdef HAVE_QUERY_CACHE
{sys_query_cache_limit.name,(char*) &sys_query_cache_limit, SHOW_SYS}, {sys_query_cache_limit.name,(char*) &sys_query_cache_limit, SHOW_SYS},
{sys_query_cache_size.name, (char*) &sys_query_cache_size, SHOW_SYS}, {sys_query_cache_size.name, (char*) &sys_query_cache_size, SHOW_SYS},
{sys_query_cache_type.name, (char*) &sys_query_cache_type, SHOW_SYS}, {sys_query_cache_type.name, (char*) &sys_query_cache_type, SHOW_SYS},
......
...@@ -1276,10 +1276,11 @@ ulong Query_cache::init_cache() ...@@ -1276,10 +1276,11 @@ ulong Query_cache::init_cache()
query_cache_size -= additional_data_size; query_cache_size -= additional_data_size;
STRUCT_LOCK(&structure_guard_mutex); STRUCT_LOCK(&structure_guard_mutex);
if (query_cache_size <= min_allocation_unit) if (max_mem_bin_size <= min_allocation_unit)
{ {
DBUG_PRINT("qcache", DBUG_PRINT("qcache",
(" query_cache_size <= min_allocation_unit => cache disabled")); (" max bin size (%lu) <= min_allocation_unit => cache disabled",
max_mem_bin_size));
STRUCT_UNLOCK(&structure_guard_mutex); STRUCT_UNLOCK(&structure_guard_mutex);
goto err; goto err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment