1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Bug#38551 query cache can still consume [very little] cpu time even when it is off.

When the query cache is disabled, the server shouldn't attempt to take the 
query cache mutex.
                             
By using the command line option --query_cache_type=0, the user can disable
   
(backport from mysql-pe)


mysql-test/t/query_cache_disabled-master.opt:
  * added test case for bug38551
mysql-test/t/query_cache_disabled.test:
  * added test case for bug38551
sql/set_var.cc:
  * Added before-trigger to verify that query_cache_type wasn't turned off or on during
  runtime.
sql/set_var.h:
  * Changed order on how the enumeration is processed. By first projecting the
  character representation of the variable to a temporary integer we can have
  one function instead of two to check if the value is valid.
sql/share/errmsg-utf8.txt:
  * Added error message for query cache disabled state
sql/sql_cache.cc:
  * If the query cache is disabled at start up, shorten the execution path and avoid
  grabbing the query cache mutex each time the invalidate interface methods are called.
sql/sql_cache.h:
  * Added new methods to set the query cache into a disabled state.
This commit is contained in:
Kristofer Pettersson
2009-10-29 12:19:36 +01:00
parent 42cdc4df8f
commit ddcdacb297
7 changed files with 124 additions and 24 deletions

View File

@ -281,8 +281,11 @@ private:
enum Cache_lock_status { UNLOCKED, LOCKED_NO_WAIT, LOCKED };
Cache_lock_status m_cache_lock_status;
bool m_query_cache_is_disabled;
void free_query_internal(Query_cache_block *point);
void invalidate_table_internal(THD *thd, uchar *key, uint32 key_length);
void disable_query_cache(void) { m_query_cache_is_disabled= TRUE; }
protected:
/*
@ -426,6 +429,8 @@ protected:
uint def_query_hash_size = QUERY_CACHE_DEF_QUERY_HASH_SIZE,
uint def_table_hash_size = QUERY_CACHE_DEF_TABLE_HASH_SIZE);
bool is_disabled(void) { return m_query_cache_is_disabled; }
/* initialize cache (mutex) */
void init();
/* resize query cache (return real query size, 0 if disabled) */