Backport #64444 to 24.3: Always start keeper with sufficient amount of threads in global pool

This commit is contained in:
robot-clickhouse 2024-07-01 07:09:13 +00:00
parent 082516bc97
commit 7e240b1b33

View File

@ -366,9 +366,10 @@ try
}
GlobalThreadPool::initialize(
config().getUInt("max_thread_pool_size", 100),
config().getUInt("max_thread_pool_free_size", 1000),
config().getUInt("thread_pool_queue_size", 10000)
/// We need to have sufficient amount of threads for connections + nuraft workers + keeper workers, 1000 is an estimation
std::min(1000U, config().getUInt("max_thread_pool_size", 1000)),
config().getUInt("max_thread_pool_free_size", 100),
config().getUInt("thread_pool_queue_size", 1000)
);
/// Wait for all threads to avoid possible use-after-free (for example logging objects can be already destroyed).
SCOPE_EXIT({