From d0c4d8f95d34cb140209090ee1bf239fe8a87b76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Chojnowski?= Date: Fri, 29 May 2026 12:32:35 +0200 Subject: [PATCH] api: add system/shard_to_numa_node_mapping Intended for test usage. (Specifically there's a test which checks memory usage by compression dictionaries, and that depends on the number of NUMA nodes, since dicts get a copy for each NUMA node). --- api/api-doc/system.json | 18 ++++++++++++++++++ api/system.cc | 5 +++++ 2 files changed, 23 insertions(+) diff --git a/api/api-doc/system.json b/api/api-doc/system.json index 4bcbd10734..3582983b54 100644 --- a/api/api-doc/system.json +++ b/api/api-doc/system.json @@ -224,6 +224,24 @@ "parameters":[] } ] + }, + { + "path":"/system/shard_to_numa_node_mapping", + "operations":[ + { + "method":"GET", + "summary":"Get the shard-to-NUMA-node mapping. The nth element is the NUMA node ID of the nth shard.", + "type":"array", + "items":{ + "type":"long" + }, + "nickname":"get_shard_to_numa_node_mapping", + "produces":[ + "application/json" + ], + "parameters":[] + } + ] } ] } diff --git a/api/system.cc b/api/system.cc index d560a8a86d..e40b5869f2 100644 --- a/api/system.cc +++ b/api/system.cc @@ -197,6 +197,11 @@ void set_system(http_context& ctx, routes& r) { return make_ready_future(seastar::to_sstring(format)); }); }); + + hs::get_shard_to_numa_node_mapping.set(r, [](const_req req) { + auto mapping = local_engine->smp().shard_to_numa_node_mapping(); + return std::vector(mapping.begin(), mapping.end()); + }); } }