mirror of
https://github.com/MariaDB/server.git
synced 2026-05-06 15:15:34 +02:00
- 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.
This commit is contained in:
parent
d4744eb9dd
commit
548070849a
2 changed files with 41 additions and 49 deletions
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue