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.cc14
1 files changed, 13 insertions, 1 deletions
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc
index b97f2a9dc1e..8bb9f57157e 100644
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
@@ -2298,6 +2298,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 +2354,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(