diff options
author | Vladislav Vaintroub <wlad@montyprogram.com> | 2011-12-18 20:40:38 +0100 |
---|---|---|
committer | Vladislav Vaintroub <wlad@montyprogram.com> | 2011-12-18 20:40:38 +0100 |
commit | a5a22e9f641623886ec7c051e7ae40eadad0b023 (patch) | |
tree | 55a9c27576b0dab700e230880e92143411b23dee /sql | |
parent | 468104567f6b0a1fe552f38717005f286c402125 (diff) | |
download | mariadb-git-a5a22e9f641623886ec7c051e7ae40eadad0b023.tar.gz |
Small adjustements to threadpool
Diffstat (limited to 'sql')
-rw-r--r-- | sql/net_serv.cc | 4 | ||||
-rw-r--r-- | sql/sql_class.cc | 1 | ||||
-rw-r--r-- | sql/sql_class.h | 3 | ||||
-rw-r--r-- | sql/sql_parse.cc | 2 | ||||
-rw-r--r-- | sql/sys_vars.cc | 6 | ||||
-rw-r--r-- | sql/threadpool.h | 3 | ||||
-rw-r--r-- | sql/threadpool_common.cc | 6 | ||||
-rw-r--r-- | sql/threadpool_unix.cc | 1 | ||||
-rw-r--r-- | sql/threadpool_win.cc | 1 |
9 files changed, 14 insertions, 13 deletions
diff --git a/sql/net_serv.cc b/sql/net_serv.cc index 9011d570497..4a35dc52fa3 100644 --- a/sql/net_serv.cc +++ b/sql/net_serv.cc @@ -1159,6 +1159,8 @@ void my_net_set_read_timeout(NET *net, uint timeout) { DBUG_ENTER("my_net_set_read_timeout"); DBUG_PRINT("enter", ("timeout: %d", timeout)); + if(net->read_timeout == timeout) + DBUG_VOID_RETURN; net->read_timeout= timeout; #ifdef NO_ALARM if (net->vio) @@ -1172,6 +1174,8 @@ void my_net_set_write_timeout(NET *net, uint timeout) { DBUG_ENTER("my_net_set_write_timeout"); DBUG_PRINT("enter", ("timeout: %d", timeout)); + if(net->write_timeout == timeout) + DBUG_VOID_RETURN; net->write_timeout= timeout; #ifdef NO_ALARM if (net->vio) diff --git a/sql/sql_class.cc b/sql/sql_class.cc index de2e49f31e9..7633a4078ff 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -749,6 +749,7 @@ THD::THD() derived_tables_processing(FALSE), spcont(NULL), m_parser_state(NULL), + skip_wait_timeout(false), #if defined(ENABLED_DEBUG_SYNC) debug_sync_control(0), #endif /* defined(ENABLED_DEBUG_SYNC) */ diff --git a/sql/sql_class.h b/sql/sql_class.h index f87af8842d8..53e0d83f37a 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -1697,6 +1697,9 @@ public: /* True if we want to log all errors */ bool log_all_errors; + /* Do not set socket timeouts for wait_timeout (used with threadpool) */ + bool skip_wait_timeout; + /* container for handler's private per-connection data */ Ha_data ha_data[MAX_HA]; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 7ee6c9fb74f..957d7965262 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -701,7 +701,7 @@ bool do_command(THD *thd) the client, the connection is closed or "net_wait_timeout" number of seconds has passed. */ - if(!skip_net_wait_timeout) + if(!thd->skip_wait_timeout) my_net_set_read_timeout(net, thd->variables.net_wait_timeout); diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index 0a142e99c67..4ba547614f5 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -2220,7 +2220,7 @@ static Sys_var_uint Sys_threadpool_size( "Number of concurrently executing threads in the pool. " "Leaving value default (0) sets it to the number of processors.", GLOBAL_VAR(threadpool_size), CMD_LINE(REQUIRED_ARG), - VALID_RANGE(0, 128), DEFAULT(0), BLOCK_SIZE(1) + VALID_RANGE(1, 128), DEFAULT(my_getncpus()), BLOCK_SIZE(1) ); static Sys_var_uint Sys_threadpool_stall_limit( "thread_pool_stall_limit", @@ -2231,12 +2231,12 @@ static Sys_var_uint Sys_threadpool_stall_limit( GLOBAL_VAR(threadpool_stall_limit), CMD_LINE(REQUIRED_ARG), VALID_RANGE(60, UINT_MAX), DEFAULT(500), BLOCK_SIZE(1) ); -#endif /*! WIN32 */ +#endif /* !WIN32 */ static Sys_var_uint Sys_threadpool_max_threads( "thread_pool_max_threads", "Maximum allowed number of worker threads in the thread pool", GLOBAL_VAR(threadpool_max_threads), CMD_LINE(REQUIRED_ARG), - VALID_RANGE(1, UINT_MAX), DEFAULT(3000), BLOCK_SIZE(1), + VALID_RANGE(1, UINT_MAX), DEFAULT(500), BLOCK_SIZE(1), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0), ON_UPDATE(fix_tp_max_threads) ); diff --git a/sql/threadpool.h b/sql/threadpool.h index 0694981d76f..fa8f1c4fbea 100644 --- a/sql/threadpool.h +++ b/sql/threadpool.h @@ -1,12 +1,9 @@ /* Threadpool parameters */ -#ifdef _WIN32 extern uint threadpool_min_threads; /* Minimum threads in pool */ -#else extern uint threadpool_idle_timeout; /* Shutdown idle worker threads after this timeout */ extern uint threadpool_size; /* Number of parallel executing threads */ extern uint threadpool_stall_limit; /* time interval in 10 ms units for stall checks*/ -#endif extern uint threadpool_max_threads; /* Maximum threads in pool */ /* diff --git a/sql/threadpool_common.cc b/sql/threadpool_common.cc index 01546162377..229c913ab44 100644 --- a/sql/threadpool_common.cc +++ b/sql/threadpool_common.cc @@ -17,13 +17,11 @@ extern void thd_cleanup(THD *thd); extern void delete_thd(THD *thd); /* Threadpool parameters */ -#ifdef _WIN32 + uint threadpool_min_threads; -#else uint threadpool_idle_timeout; uint threadpool_size; uint threadpool_stall_limit; -#endif uint threadpool_max_threads; @@ -127,7 +125,7 @@ int threadpool_add_connection(THD *thd) thd->net.reading_or_writing= 1; } } - + thd->skip_wait_timeout= true; thread_detach(thd, psi_thread); return retval; } diff --git a/sql/threadpool_unix.cc b/sql/threadpool_unix.cc index 57bff93e951..f0d7d5f33be 100644 --- a/sql/threadpool_unix.cc +++ b/sql/threadpool_unix.cc @@ -1198,7 +1198,6 @@ bool tp_init() DBUG_ENTER("tp_init"); started = true; scheduler_init(); - skip_net_wait_timeout= 1; if (threadpool_size == 0) { threadpool_size= my_getncpus(); diff --git a/sql/threadpool_win.cc b/sql/threadpool_win.cc index 4e46e393c24..0afb628a1ca 100644 --- a/sql/threadpool_win.cc +++ b/sql/threadpool_win.cc @@ -520,7 +520,6 @@ bool tp_init(void) } #endif - skip_net_wait_timeout = 1; return 0; } |