summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladislav Vaintroub <wlad@montyprogram.com>2011-12-29 21:11:06 +0100
committerVladislav Vaintroub <wlad@montyprogram.com>2011-12-29 21:11:06 +0100
commitbb0a0c52a65ce3a0621fcfc133d724b0485bb5c3 (patch)
tree37d6b5c0aa6a5b47dc03c97768b1c1566235e385
parent539a7ebe1038560c8de1d521120058907f2604bf (diff)
downloadmariadb-git-bb0a0c52a65ce3a0621fcfc133d724b0485bb5c3.tar.gz
Make threadpool_stall_limit variable really dynamic
-rw-r--r--sql/sys_vars.cc12
-rw-r--r--sql/threadpool.h1
-rw-r--r--sql/threadpool_unix.cc11
3 files changed, 22 insertions, 2 deletions
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc
index 4cfb41d5b75..6feba50a00d 100644
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
@@ -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(
diff --git a/sql/threadpool.h b/sql/threadpool.h
index 4272d9a11f1..a8e7f9031b3 100644
--- a/sql/threadpool.h
+++ b/sql/threadpool.h
@@ -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);
diff --git a/sql/threadpool_unix.cc b/sql/threadpool_unix.cc
index 32847e91a32..d9eb90532af 100644
--- a/sql/threadpool_unix.cc
+++ b/sql/threadpool_unix.cc
@@ -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));
+}