summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <sanja@askmonty.org>2013-07-16 15:44:38 +0300
committerunknown <sanja@askmonty.org>2013-07-16 15:44:38 +0300
commit18cb29d43254e5f065bbbe180917231650c2e5a7 (patch)
treee0767ebb5298a4c905a265c19815eace0c994157
parent097e65625a0a6748ebb11225382ff69bbc35140e (diff)
downloadmariadb-git-18cb29d43254e5f065bbbe180917231650c2e5a7.tar.gz
MDEV-4570 [PATCH] Sys_query_cache_limit initialization depends on initialization in other source files
-rw-r--r--sql/mysqld.cc2
-rw-r--r--sql/mysqld.h1
-rw-r--r--sql/sys_vars.cc11
3 files changed, 12 insertions, 2 deletions
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index db28ae8098e..d28bdea9d20 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -488,6 +488,7 @@ ulong slave_max_allowed_packet= 0;
ulonglong binlog_stmt_cache_size=0;
ulonglong max_binlog_stmt_cache_size=0;
ulonglong query_cache_size=0;
+ulong query_cache_limit=0;
ulong refresh_version; /* Increments on each reload */
ulong executed_events=0;
query_id_t global_query_id;
@@ -4466,6 +4467,7 @@ static int init_server_components()
query_cache_set_min_res_unit(query_cache_min_res_unit);
query_cache_init();
query_cache_resize(query_cache_size);
+ query_cache_result_size_limit(query_cache_limit);
my_rnd_init(&sql_rand,(ulong) server_start_time,(ulong) server_start_time/2);
setup_fpu();
init_thr_lock();
diff --git a/sql/mysqld.h b/sql/mysqld.h
index eb72b7e2736..d82bd79d935 100644
--- a/sql/mysqld.h
+++ b/sql/mysqld.h
@@ -156,6 +156,7 @@ extern ulong delayed_insert_threads, delayed_insert_writes;
extern ulong delayed_rows_in_use,delayed_insert_errors;
extern ulong slave_open_temp_tables;
extern ulonglong query_cache_size;
+extern ulong query_cache_limit;
extern ulong query_cache_min_res_unit;
extern ulong slow_launch_threads, slow_launch_time;
extern ulong table_cache_size, table_def_size;
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc
index 109d00bfa47..01745eba252 100644
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
@@ -2245,6 +2245,11 @@ static bool fix_query_cache_size(sys_var *self, THD *thd, enum_var_type type)
query_cache_size= new_cache_size;
return false;
}
+static bool fix_query_cache_limit(sys_var *self, THD *thd, enum_var_type type)
+{
+ query_cache.result_size_limit(query_cache_limit);
+ return false;
+}
static Sys_var_ulonglong Sys_query_cache_size(
"query_cache_size",
"The memory allocated to store results from old queries",
@@ -2256,8 +2261,10 @@ static Sys_var_ulonglong Sys_query_cache_size(
static Sys_var_ulong Sys_query_cache_limit(
"query_cache_limit",
"Don't cache results that are bigger than this",
- GLOBAL_VAR(query_cache.query_cache_limit), CMD_LINE(REQUIRED_ARG),
- VALID_RANGE(0, UINT_MAX), DEFAULT(1024*1024), BLOCK_SIZE(1));
+ GLOBAL_VAR(query_cache_limit), CMD_LINE(REQUIRED_ARG),
+ VALID_RANGE(0, UINT_MAX), DEFAULT(1024*1024), BLOCK_SIZE(1),
+ NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(NULL),
+ ON_UPDATE(fix_query_cache_limit));
static bool fix_qcache_min_res_unit(sys_var *self, THD *thd, enum_var_type type)
{