Commit 5b4e69c0 authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

MDEV-23224 Windows threadpool - use better threadpool_max_threads default.

Use max_connections in calculation, top prevent possible deadlock, if
max_connection is high.
parent 01d994b3
...@@ -355,10 +355,13 @@ int TP_pool_win::init() ...@@ -355,10 +355,13 @@ int TP_pool_win::init()
if (IS_SYSVAR_AUTOSIZE(&threadpool_max_threads)) if (IS_SYSVAR_AUTOSIZE(&threadpool_max_threads))
{ {
/* /*
Nr 500 comes from Microsoft documentation, Default 500 comes from Microsoft documentation,
there is no API for GetThreadpoolThreadMaxThreads() there is no API for GetThreadpoolThreadMaxThreads().
To avoid deadlocks, allow at least max_connections + safety
margin threads in the pool.
*/ */
SYSVAR_AUTOSIZE(threadpool_max_threads,500); SYSVAR_AUTOSIZE(threadpool_max_threads,std::max(500U,(uint)max_connections + 10));
} }
else else
{ {
......
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