Skip to content

Commit 5b4e69c

Browse files
committed
MDEV-23224 Windows threadpool - use better threadpool_max_threads default.
Use max_connections in calculation, top prevent possible deadlock, if max_connection is high.
1 parent 01d994b commit 5b4e69c

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

sql/threadpool_win.cc

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -355,10 +355,13 @@ int TP_pool_win::init()
355355
if (IS_SYSVAR_AUTOSIZE(&threadpool_max_threads))
356356
{
357357
/*
358-
Nr 500 comes from Microsoft documentation,
359-
there is no API for GetThreadpoolThreadMaxThreads()
358+
Default 500 comes from Microsoft documentation,
359+
there is no API for GetThreadpoolThreadMaxThreads().
360+
361+
To avoid deadlocks, allow at least max_connections + safety
362+
margin threads in the pool.
360363
*/
361-
SYSVAR_AUTOSIZE(threadpool_max_threads,500);
364+
SYSVAR_AUTOSIZE(threadpool_max_threads,std::max(500U,(uint)max_connections + 10));
362365
}
363366
else
364367
{

0 commit comments

Comments
 (0)