Commit bb0a0c52 authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

Make threadpool_stall_limit variable really dynamic

parent 539a7ebe
......@@ -2211,6 +2211,12 @@ static bool fix_threadpool_size(sys_var*, THD*, enum_var_type)
tp_set_threadpool_size(threadpool_size);
return false;
}
static bool fix_threadpool_stall_limit(sys_var*, THD*, enum_var_type)
{
tp_set_threadpool_stall_limit(threadpool_size);
}
#endif
#ifdef _WIN32
......@@ -2241,12 +2247,14 @@ static Sys_var_uint Sys_threadpool_size(
);
static Sys_var_uint Sys_threadpool_stall_limit(
"thread_pool_stall_limit",
"Maximum query execution time before in milliseconds,"
"Maximum query execution time in milliseconds,"
"before an executing non-yielding thread is considered stalled."
"If a worker thread is stalled, additional worker thread "
"may be created to handle remaining clients.",
GLOBAL_VAR(threadpool_stall_limit), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(60, UINT_MAX), DEFAULT(500), BLOCK_SIZE(1)
VALID_RANGE(60, UINT_MAX), DEFAULT(500), BLOCK_SIZE(1),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(fix_threadpool_stall_limit)
);
#endif /* !WIN32 */
static Sys_var_uint Sys_threadpool_max_threads(
......
......@@ -41,6 +41,7 @@ extern TP_STATISTICS tp_stats;
extern void tp_set_min_threads(uint val);
extern void tp_set_max_threads(uint val);
extern int tp_set_threadpool_size(uint val);
extern void tp_set_threadpool_stall_limit(uint val);
/* Activate threadpool scheduler */
extern void tp_scheduler(void);
......
......@@ -1324,6 +1324,7 @@ bool tp_init()
DBUG_RETURN(0);
}
void tp_end()
{
DBUG_ENTER("tp_end");
......@@ -1365,3 +1366,13 @@ int tp_set_threadpool_size(uint size)
group_count= size;
return 0;
}
void tp_set_threadpool_stall_limit(uint limit)
{
if (!started)
return;
mysql_mutex_lock(&(pool_timer.mutex));
pool_timer.tick_interval= limit;
mysql_cond_signal(&(pool_timer.cond));
mysql_mutex_unlock(&(pool_timer.mutex));
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment