Commit 91f1d599 authored by unknown's avatar unknown

Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-4.0

into sanja.is.com.ua:/home/bell/mysql/bk/work-4.0

parents c01bcf47 185f0092
...@@ -501,22 +501,62 @@ drop table t1; ...@@ -501,22 +501,62 @@ 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
create table t1 (a int);
set GLOBAL query_cache_size=1000; set GLOBAL query_cache_size=1000;
show global variables like "query_cache_size"; show global variables like "query_cache_size";
Variable_name Value Variable_name Value
query_cache_size 0 query_cache_size 0
set GLOBAL query_cache_size=1100; select * from t1;
set GLOBAL query_cache_size=1200; a
set GLOBAL query_cache_size=1300; set GLOBAL query_cache_size=1024;
set GLOBAL query_cache_size=1400; show global variables like "query_cache_size";
set GLOBAL query_cache_size=1500; Variable_name Value
set GLOBAL query_cache_size=1600; query_cache_size 0
set GLOBAL query_cache_size=1700; select * from t1;
set GLOBAL query_cache_size=1800; a
set GLOBAL query_cache_size=1900; set GLOBAL query_cache_size=10240;
show global variables like "query_cache_size";
Variable_name Value
query_cache_size 0
select * from t1;
a
set GLOBAL query_cache_size=20480;
show global variables like "query_cache_size";
Variable_name Value
query_cache_size 0
select * from t1;
a
set GLOBAL query_cache_size=40960;
show global variables like "query_cache_size";
Variable_name Value
query_cache_size 0
select * from t1;
a
set GLOBAL query_cache_size=51200;
show global variables like "query_cache_size";
Variable_name Value
query_cache_size 51200
select * from t1;
a
set GLOBAL query_cache_size=61440;
show global variables like "query_cache_size"; show global variables like "query_cache_size";
Variable_name Value Variable_name Value
query_cache_size 1024 query_cache_size 61440
select * from t1;
a
set GLOBAL query_cache_size=81920;
show global variables like "query_cache_size";
Variable_name Value
query_cache_size 81920
select * from t1;
a
set GLOBAL query_cache_size=102400;
show global variables like "query_cache_size";
Variable_name Value
query_cache_size 102400
select * from t1;
a
drop table t1;
set GLOBAL query_cache_size=1048576; set GLOBAL query_cache_size=1048576;
create table t1 (i int not null); create table t1 (i int not null);
create table t2 (i int not null); create table t2 (i int not null);
......
...@@ -343,18 +343,35 @@ show status like "Qcache_queries_in_cache"; ...@@ -343,18 +343,35 @@ show status like "Qcache_queries_in_cache";
# #
# Test of query cache resizing # Test of query cache resizing
# #
create table t1 (a int);
set GLOBAL query_cache_size=1000; set GLOBAL query_cache_size=1000;
show global variables like "query_cache_size"; show global variables like "query_cache_size";
set GLOBAL query_cache_size=1100; select * from t1;
set GLOBAL query_cache_size=1200; set GLOBAL query_cache_size=1024;
set GLOBAL query_cache_size=1300; show global variables like "query_cache_size";
set GLOBAL query_cache_size=1400; select * from t1;
set GLOBAL query_cache_size=1500; set GLOBAL query_cache_size=10240;
set GLOBAL query_cache_size=1600; show global variables like "query_cache_size";
set GLOBAL query_cache_size=1700; select * from t1;
set GLOBAL query_cache_size=1800; set GLOBAL query_cache_size=20480;
set GLOBAL query_cache_size=1900; show global variables like "query_cache_size";
select * from t1;
set GLOBAL query_cache_size=40960;
show global variables like "query_cache_size";
select * from t1;
set GLOBAL query_cache_size=51200;
show global variables like "query_cache_size";
select * from t1;
set GLOBAL query_cache_size=61440;
show global variables like "query_cache_size";
select * from t1;
set GLOBAL query_cache_size=81920;
show global variables like "query_cache_size"; show global variables like "query_cache_size";
select * from t1;
set GLOBAL query_cache_size=102400;
show global variables like "query_cache_size";
select * from t1;
drop table t1;
# #
# Temporary tables # Temporary tables
......
...@@ -731,7 +731,7 @@ ulong Query_cache::resize(ulong query_cache_size_arg) ...@@ -731,7 +731,7 @@ ulong Query_cache::resize(ulong query_cache_size_arg)
query_cache_size_arg)); query_cache_size_arg));
free_cache(0); free_cache(0);
query_cache_size= query_cache_size_arg; query_cache_size= query_cache_size_arg;
DBUG_RETURN(init_cache()); DBUG_RETURN(::query_cache_size= init_cache());
} }
...@@ -1282,6 +1282,12 @@ ulong Query_cache::init_cache() ...@@ -1282,6 +1282,12 @@ ulong Query_cache::init_cache()
mem_bin_steps = 1; mem_bin_steps = 1;
mem_bin_size = max_mem_bin_size >> QUERY_CACHE_MEM_BIN_STEP_PWR2; mem_bin_size = max_mem_bin_size >> QUERY_CACHE_MEM_BIN_STEP_PWR2;
prev_size = 0; prev_size = 0;
if (mem_bin_size <= min_allocation_unit)
{
DBUG_PRINT("qcache", ("too small query cache => query cache disabled"));
// TODO here (and above) should be warning in 4.1
goto err;
}
while (mem_bin_size > min_allocation_unit) while (mem_bin_size > min_allocation_unit)
{ {
mem_bin_num += mem_bin_count; mem_bin_num += mem_bin_count;
...@@ -1308,14 +1314,6 @@ ulong Query_cache::init_cache() ...@@ -1308,14 +1314,6 @@ 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 (max_mem_bin_size <= min_allocation_unit)
{
DBUG_PRINT("qcache",
(" max bin size (%lu) <= min_allocation_unit => cache disabled",
max_mem_bin_size));
STRUCT_UNLOCK(&structure_guard_mutex);
goto err;
}
if (!(cache = (byte *) if (!(cache = (byte *)
my_malloc_lock(query_cache_size+additional_data_size, MYF(0)))) my_malloc_lock(query_cache_size+additional_data_size, MYF(0))))
......
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