From fd9f1638ea7401e9bc72653882fded4c0dee15d8 Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Tue, 5 Nov 2013 09:18:59 +0400 Subject: MDEV-5205 - MariaDB does not start if more than 128 cpu's are available - thread_pool_size command line option upper limit increased to 100 000 (same as for max_connections) - thread_pool_size system variable upper limit is maximum of 128 or the value given at command line - thread groups are now allocated dynamically Different limit for command line option and system variable was done to avoid additional mutex for all_groups and threadpool_max_size. --- sql/sys_vars.cc | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'sql/sys_vars.cc') 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( -- cgit v1.2.1