MDEV-23224 Windows threadpool - use better threadpool_max_threads default.

Use max_connections in calculation, top prevent possible deadlock, if
max_connection is high.
This commit is contained in:
Vladislav Vaintroub 2024-03-19 11:57:38 +01:00
parent 01d994b39a
commit 5b4e69c059

View file

@ -355,10 +355,13 @@ int TP_pool_win::init()
if (IS_SYSVAR_AUTOSIZE(&threadpool_max_threads))
{
/*
Nr 500 comes from Microsoft documentation,
there is no API for GetThreadpoolThreadMaxThreads()
Default 500 comes from Microsoft documentation,
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
{