From debfb147f5eb0a07586d8f159c86facdfa73ec1f Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Fri, 10 Apr 2026 13:41:12 +0300 Subject: [PATCH] describe_statement: Get cluster info from storage_service Update cluster_describe_statement::describe() to retrieve cluster metadata from storage_service::describe_cluster() instead of directly from db::config or gossiper. The storage_service provides a centralized API for accessing cluster metadata (cluster_name, partitioner, snitch_name) that works in both normal and maintenance modes, improving separation of concerns. Signed-off-by: Pavel Emelyanov Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- cql3/statements/describe_statement.cc | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/cql3/statements/describe_statement.cc b/cql3/statements/describe_statement.cc index c254ac734b..48384b2960 100644 --- a/cql3/statements/describe_statement.cc +++ b/cql3/statements/describe_statement.cc @@ -49,7 +49,6 @@ #include "cql3/functions/user_function.hh" #include "cql3/functions/user_aggregate.hh" #include "utils/overloaded_functor.hh" -#include "db/config.hh" #include "db/system_keyspace.hh" #include "db/extensions.hh" #include "utils/sorting.hh" @@ -614,17 +613,14 @@ future cluster_describe_statement::range_ownership(const serv } future>> cluster_describe_statement::describe(cql3::query_processor& qp, const service::client_state& client_state) const { - auto db = qp.db(); auto& proxy = qp.proxy(); + auto& ss = qp.storage_service(); - auto cluster = to_managed_bytes(db.get_config().cluster_name()); - auto partitioner = to_managed_bytes(db.get_config().partitioner()); - auto snitch = to_managed_bytes(db.get_config().endpoint_snitch()); - + auto cluster_info = ss.describe_cluster(); std::vector row { - {cluster}, - {partitioner}, - {snitch} + {to_managed_bytes(cluster_info.cluster_name)}, + {to_managed_bytes(cluster_info.partitioner)}, + {to_managed_bytes(cluster_info.snitch_name)} }; if (should_add_range_ownership(proxy.local_db(), client_state)) {