diff options
author | unknown <thek@adventure.(none)> | 2007-05-23 12:54:15 +0200 |
---|---|---|
committer | unknown <thek@adventure.(none)> | 2007-05-23 12:54:15 +0200 |
commit | 548070849a4ca440b5d0619496db22cd69ae2d04 (patch) | |
tree | d225e7cc951517265ef2ad62e5912e935fcda17d /sql/set_var.cc | |
parent | d4744eb9dda6deb09c6c90c8beb0e0390f7ce568 (diff) | |
download | mariadb-git-548070849a4ca440b5d0619496db22cd69ae2d04.tar.gz |
- This patch addesses the performance issues with invalidating the entire
cache by changing the behavior of the query cache resize-method.
- set query_cache_size=<new_size>; is significantly faster than RESET QUERY
CACHE as it simply destroys and recreates the query cache, whereas
RESET QUERY CACHE keeps its internal structure aligned with server
load profile.
sql/set_var.cc:
Refactored behavior of function. Instead of setting the global variable
from within the class method scope we return the new cache size as a
result of the method call.
sql/sql_cache.cc:
- Changed behavior of resize-method. Now, the cache will be cleared as one
single block of data instead of an iteration over all cached statements.
Diffstat (limited to 'sql/set_var.cc')
-rw-r--r-- | sql/set_var.cc | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/sql/set_var.cc b/sql/set_var.cc index ea2888aec56..e7588632595 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -1275,12 +1275,19 @@ static void fix_net_retry_count(THD *thd __attribute__((unused)), static void fix_query_cache_size(THD *thd, enum_var_type type) { #ifdef HAVE_QUERY_CACHE - ulong requested= query_cache_size; - query_cache.resize(query_cache_size); - if (requested != query_cache_size) + ulong new_cache_size= query_cache.resize(query_cache_size); + + /* + Note: query_cache_size is a global variable reflecting the + requested cache size. See also query_cache_size_arg + */ + + if (query_cache_size != new_cache_size) push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_QC_RESIZE, ER(ER_WARN_QC_RESIZE), - requested, query_cache_size); + query_cache_size, new_cache_size); + + query_cache_size= new_cache_size; #endif } |