summaryrefslogtreecommitdiff
path: root/sql/sql_cache.cc
diff options
context:
space:
mode:
authorKristofer Pettersson <kpettersson@mysql.com>2008-06-19 02:40:35 +0200
committerKristofer Pettersson <kpettersson@mysql.com>2008-06-19 02:40:35 +0200
commit71be65dd114d0a2bd914bcdb1879015fd76ba2b4 (patch)
tree9f9ed6712c8a4a8a17d912a0597167331a65737b /sql/sql_cache.cc
parent22bd6d9de6b17061189c6730879fcc8fbc8d87b5 (diff)
downloadmariadb-git-71be65dd114d0a2bd914bcdb1879015fd76ba2b4.tar.gz
Bug#30087 Set query_cache_size, if the value is too small, get a unclear warning
This bugs clarifies a warning message issued when the query cache data size becomes smaller than the minium allowed size.
Diffstat (limited to 'sql/sql_cache.cc')
-rw-r--r--sql/sql_cache.cc29
1 files changed, 29 insertions, 0 deletions
diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc
index f8906a17c12..cce5123aef3 100644
--- a/sql/sql_cache.cc
+++ b/sql/sql_cache.cc
@@ -816,6 +816,16 @@ ulong Query_cache::resize(ulong query_cache_size_arg)
free_cache();
query_cache_size= query_cache_size_arg;
::query_cache_size= init_cache();
+
+ if (::query_cache_size != query_cache_size_arg)
+ {
+ push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_WARN_QC_RESIZE, ER(ER_WARN_QC_RESIZE),
+ query_cache_size_arg,
+ get_minimal_size_limit(),
+ ::query_cache_size);
+ }
+
STRUCT_UNLOCK(&structure_guard_mutex);
DBUG_RETURN(::query_cache_size);
}
@@ -1614,6 +1624,25 @@ void Query_cache::init()
}
+/**
+ Return the lowest possible query cache size.
+*/
+
+ulong Query_cache::get_minimal_size_limit()
+{
+ ulong approx_additional_data_size= (sizeof(Query_cache) +
+ sizeof(gptr)*(def_query_hash_size+
+ def_table_hash_size));
+
+ ulong data_size= (min_allocation_unit << QUERY_CACHE_MEM_BIN_STEP_PWR2 <<
+ QUERY_CACHE_MEM_BIN_FIRST_STEP_PWR2) +
+ ALIGN_SIZE(1) - 1 +
+ (1 << QUERY_CACHE_MEM_BIN_STEP_PWR2) - 1 +
+ (1 << QUERY_CACHE_MEM_BIN_FIRST_STEP_PWR2) - 1;
+
+ return(data_size + approx_additional_data_size);
+}
+
ulong Query_cache::init_cache()
{
uint mem_bin_count, num, step;