From c77b2417c8c112cdbb0d74341329fcfe328104e2 Mon Sep 17 00:00:00 2001 From: Andrew Gooding Date: Tue, 12 Nov 2024 16:55:57 -0800 Subject: [PATCH] AER-6782 - ensure config defaults based on number of CPUs don't exceed the max config values allowed. (E.g. an issue for 'batch-index-threads' if more than 256 CPUs.) --- as/src/base/batch.c | 4 ++++ as/src/base/cfg.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/as/src/base/batch.c b/as/src/base/batch.c index 684230e7..be9646ac 100644 --- a/as/src/base/batch.c +++ b/as/src/base/batch.c @@ -812,6 +812,10 @@ as_batch_init() // Default 'batch-index-threads' can't be set before call to cf_topo_init(). if (g_config.n_batch_index_threads == 0) { g_config.n_batch_index_threads = cf_topo_count_cpus(); + + if (g_config.n_batch_index_threads > MAX_BATCH_THREADS) { + g_config.n_batch_index_threads = MAX_BATCH_THREADS; + } } cf_info(AS_BATCH, "starting %u batch-index-threads", g_config.n_batch_index_threads); diff --git a/as/src/base/cfg.c b/as/src/base/cfg.c index 4835d84a..bbe76d45 100644 --- a/as/src/base/cfg.c +++ b/as/src/base/cfg.c @@ -4407,6 +4407,10 @@ as_config_post_process(as_config* c, const char* config_file) if (c->n_service_threads == 0) { c->n_service_threads = c->n_namespaces_not_inlined != 0 ? n_cpus * 5 : n_cpus; + + if (c->n_service_threads > MAX_SERVICE_THREADS) { + c->n_service_threads = MAX_SERVICE_THREADS; + } } // Setup performance metrics histograms.