diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 385ce13..50dd0ad 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -494,6 +494,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; @@ -4438,6 +4439,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 3602a3b..d0aad1a 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 d399d6e..a5ff458 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -2108,6 +2108,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", @@ -2119,8 +2124,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) {