From ec15459a0021d1a5163b214610b934bd67983d6b Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 9 Apr 2004 18:50:28 +0200 Subject: make session max_delayed_threads to be settable only to 0 or global value --- sql/set_var.cc | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'sql/set_var.cc') diff --git a/sql/set_var.cc b/sql/set_var.cc index f47e013eb94..d2224439ddf 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -101,6 +101,7 @@ static void fix_myisam_max_sort_file_size(THD *thd, enum_var_type type); static void fix_max_binlog_size(THD *thd, enum_var_type type); static void fix_max_relay_log_size(THD *thd, enum_var_type type); static void fix_max_connections(THD *thd, enum_var_type type); +static int check_max_delayed_threads(THD *thd, set_var *var); static void fix_thd_mem_root(THD *thd, enum_var_type type); static void fix_trans_mem_root(THD *thd, enum_var_type type); static KEY_CACHE *create_key_cache(const char *name, uint length); @@ -201,10 +202,13 @@ sys_var_long_ptr sys_max_connections("max_connections", sys_var_long_ptr sys_max_connect_errors("max_connect_errors", &max_connect_errors); sys_var_thd_ulong sys_max_insert_delayed_threads("max_insert_delayed_threads", - &SV::max_insert_delayed_threads); + &SV::max_insert_delayed_threads, + check_max_delayed_threads, + fix_max_connections); sys_var_thd_ulong sys_max_delayed_threads("max_delayed_threads", &SV::max_insert_delayed_threads, - 0, fix_max_connections); + check_max_delayed_threads, + fix_max_connections); sys_var_thd_ulong sys_max_error_count("max_error_count", &SV::max_error_count); sys_var_thd_ulong sys_max_heap_table_size("max_heap_table_size", @@ -1084,6 +1088,19 @@ static void fix_max_relay_log_size(THD *thd, enum_var_type type) } +static int check_max_delayed_threads(THD *thd, set_var *var) +{ + int val= var->value->val_int(); + if (var->type != OPT_GLOBAL && val != 0 && + val != global_system_variables.max_insert_delayed_threads) + { + char buf[64]; + my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), var->var->name, llstr(val, buf)); + return 1; + } + return 0; +} + static void fix_max_connections(THD *thd, enum_var_type type) { resize_thr_alarm(max_connections + -- cgit v1.2.1