summaryrefslogtreecommitdiff
path: root/sql/set_var.h
diff options
context:
space:
mode:
authorKristofer Pettersson <kristofer.pettersson@sun.com>2009-10-29 12:19:36 +0100
committerKristofer Pettersson <kristofer.pettersson@sun.com>2009-10-29 12:19:36 +0100
commitddcdacb297ffd42f38743321f7861451e77ce142 (patch)
treeee40d9b2a4d8b057cf54f1c758a85e0cbc092ab4 /sql/set_var.h
parent42cdc4df8f4a2ed375d935d7d3dd8a877fa9e007 (diff)
downloadmariadb-git-ddcdacb297ffd42f38743321f7861451e77ce142.tar.gz
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.
Diffstat (limited to 'sql/set_var.h')
-rw-r--r--sql/set_var.h14
1 files changed, 10 insertions, 4 deletions
diff --git a/sql/set_var.h b/sql/set_var.h
index a83de6425ae..c08097521d2 100644
--- a/sql/set_var.h
+++ b/sql/set_var.h
@@ -543,10 +543,16 @@ public:
{ chain_sys_var(chain); }
bool check(THD *thd, set_var *var)
{
- int ret= 0;
- if (check_func)
- ret= (*check_func)(thd, var);
- return ret ? ret : check_enum(thd, var, enum_names);
+ /*
+ check_enum fails if the character representation supplied was wrong
+ or that the integer value was wrong or missing.
+ */
+ if (check_enum(thd, var, enum_names))
+ return TRUE;
+ else if ((check_func && (*check_func)(thd, var)))
+ return TRUE;
+ else
+ return FALSE;
}
bool update(THD *thd, set_var *var);
void set_default(THD *thd, enum_var_type type);