summaryrefslogtreecommitdiff
path: root/sql/sys_vars.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sys_vars.cc')
-rw-r--r--sql/sys_vars.cc22
1 files changed, 19 insertions, 3 deletions
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc
index 88dee072b89..98f4e644171 100644
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
@@ -667,6 +667,7 @@ static bool event_scheduler_check(sys_var *self, THD *thd, set_var *var)
}
static bool event_scheduler_update(sys_var *self, THD *thd, enum_var_type type)
{
+ int err_no= 0;
uint opt_event_scheduler_value= Events::opt_event_scheduler;
mysql_mutex_unlock(&LOCK_global_system_variables);
/*
@@ -686,11 +687,14 @@ static bool event_scheduler_update(sys_var *self, THD *thd, enum_var_type type)
for deadlocks. See bug#51160.
*/
bool ret= opt_event_scheduler_value == Events::EVENTS_ON
- ? Events::start()
+ ? Events::start(&err_no)
: Events::stop();
mysql_mutex_lock(&LOCK_global_system_variables);
if (ret)
- my_error(ER_EVENT_SET_VAR_ERROR, MYF(0), 0);
+ {
+ Events::opt_event_scheduler= Events::EVENTS_OFF;
+ my_error(ER_EVENT_SET_VAR_ERROR, MYF(0), err_no);
+ }
return ret;
}
@@ -2298,6 +2302,18 @@ static bool fix_tp_min_threads(sys_var *, THD *, enum_var_type)
#ifndef _WIN32
+static bool check_threadpool_size(sys_var *self, THD *thd, set_var *var)
+{
+ ulonglong v= var->save_result.ulonglong_value;
+ if (v > threadpool_max_size)
+ {
+ var->save_result.ulonglong_value= threadpool_max_size;
+ return throw_bounds_warning(thd, self->name.str, true, true, v);
+ }
+ return false;
+}
+
+
static bool fix_threadpool_size(sys_var*, THD*, enum_var_type)
{
tp_set_threadpool_size(threadpool_size);
@@ -2342,7 +2358,7 @@ static Sys_var_uint Sys_threadpool_size(
"executing threads (threads in a waiting state do not count as executing).",
GLOBAL_VAR(threadpool_size), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(1, MAX_THREAD_GROUPS), DEFAULT(my_getncpus()), BLOCK_SIZE(1),
- NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
+ NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_threadpool_size),
ON_UPDATE(fix_threadpool_size)
);
static Sys_var_uint Sys_threadpool_stall_limit(