mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
fixed bug 549 - incorect query cache memory formating on very small query cache sizes
mysql-test/r/query_cache.result: test of 2 parts of bug 549 mysql-test/t/query_cache.test: test of 2 parts of bug 549 sql/sql_cache.cc: fixed query cache size showing fixed query cache low memory detection
This commit is contained in:
@ -731,7 +731,7 @@ ulong Query_cache::resize(ulong query_cache_size_arg)
|
||||
query_cache_size_arg));
|
||||
free_cache(0);
|
||||
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()
|
||||
mem_bin_steps = 1;
|
||||
mem_bin_size = max_mem_bin_size >> QUERY_CACHE_MEM_BIN_STEP_PWR2;
|
||||
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)
|
||||
{
|
||||
mem_bin_num += mem_bin_count;
|
||||
@ -1308,14 +1314,6 @@ ulong Query_cache::init_cache()
|
||||
query_cache_size -= additional_data_size;
|
||||
|
||||
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 *)
|
||||
my_malloc_lock(query_cache_size+additional_data_size, MYF(0))))
|
||||
|
Reference in New Issue
Block a user