diff options
Diffstat (limited to 'sql/sql_cache.cc')
-rw-r--r-- | sql/sql_cache.cc | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc index 7a154d206ef..ac6471e794c 100644 --- a/sql/sql_cache.cc +++ b/sql/sql_cache.cc @@ -739,7 +739,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()); } @@ -1318,6 +1318,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; @@ -1344,14 +1350,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)))) |