diff options
author | Sergei Golubchik <sergii@pisem.net> | 2012-01-16 21:06:23 +0100 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2012-01-16 21:06:23 +0100 |
commit | 2ec0f46b88bc5f1d565d65025b7a868c6943ab0c (patch) | |
tree | de28d5051f89c5f6d6592d955b4e4f8498cecc44 /sql | |
parent | baca1a40e98c4d1ac107118f5f4b6012f398bdf2 (diff) | |
download | mariadb-git-2ec0f46b88bc5f1d565d65025b7a868c6943ab0c.tar.gz |
query cache sysvar fixes
sql/share/errmsg-utf8.txt:
correct the error message, as query_cache_type variable is not read-ony anymore
sql/sql_cache.cc:
the caller should verify that query cache resize
is possible, before trying it
sql/sys_vars.cc:
* test if qc resize is possible in the sysvar on_check() funntion,
not in the on_update() function.
* use the error message that better describes the problem
Diffstat (limited to 'sql')
-rw-r--r-- | sql/share/errmsg-utf8.txt | 3 | ||||
-rw-r--r-- | sql/sql_cache.cc | 1 | ||||
-rw-r--r-- | sql/sys_vars.cc | 15 |
3 files changed, 15 insertions, 4 deletions
diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt index 4798483860c..872e80ab542 100644 --- a/sql/share/errmsg-utf8.txt +++ b/sql/share/errmsg-utf8.txt @@ -6270,8 +6270,7 @@ ER_SLAVE_IGNORE_SERVER_IDS eng "The requested server id %d clashes with the slave startup option --replicate-same-server-id" ger "Die angeforderte Server-ID %d steht im Konflikt mit der Startoption --replicate-same-server-id für den Slave" ER_QUERY_CACHE_DISABLED - eng "Query cache is disabled; restart the server with query_cache_type=1 to enable it" - ger "Abfragen-Cache ist deaktiviert. Starten Sie den Server neu mit query_cache_type=1, um ihn zu aktivieren" + eng "Query cache is disabled; set query_cache_type to ON or DEMAND to enable it" ER_SAME_NAME_PARTITION_FIELD eng "Duplicate partition field name '%-.192s'" ger "Partitionsfeld '%-.192s' ist ein Duplikat" diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc index 7212f6996eb..0a1185a9924 100644 --- a/sql/sql_cache.cc +++ b/sql/sql_cache.cc @@ -1292,6 +1292,7 @@ ulong Query_cache::resize(ulong query_cache_size_arg) if (global_system_variables.query_cache_type == 0) { + DBUG_ASSERT(query_cache_size_arg == 0); if (query_cache_size_arg != 0) my_error(ER_QUERY_CACHE_IS_DISABLED, MYF(0)); DBUG_RETURN(0); diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index 7cdd5b3f65e..9da2393a0ad 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -1819,6 +1819,17 @@ static Sys_var_enum Sys_thread_handling( thread_handling_names, DEFAULT(0)); #ifdef HAVE_QUERY_CACHE +static bool check_query_cache_size(sys_var *self, THD *thd, set_var *var) +{ + if (global_system_variables.query_cache_type == 0 && + var->value && var->value->val_int() != 0) + { + my_error(ER_QUERY_CACHE_DISABLED, MYF(0)); + return true; + } + + return false; +} static bool fix_query_cache_size(sys_var *self, THD *thd, enum_var_type type) { ulong new_cache_size= query_cache.resize(query_cache_size); @@ -1839,7 +1850,7 @@ static Sys_var_ulonglong Sys_query_cache_size( "The memory allocated to store results from old queries", GLOBAL_VAR(query_cache_size), CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, ULONGLONG_MAX), DEFAULT(0), BLOCK_SIZE(1024), - NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0), + NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_query_cache_size), ON_UPDATE(fix_query_cache_size)); static Sys_var_ulong Sys_query_cache_limit( @@ -1867,7 +1878,7 @@ static bool check_query_cache_type(sys_var *self, THD *thd, set_var *var) { if (query_cache.is_disable_in_progress()) { - my_error(ER_QUERY_CACHE_DISABLED, MYF(0)); + my_error(ER_QUERY_CACHE_IS_DISABLED, MYF(0)); return true; } if (var->type != OPT_GLOBAL && |