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 <xemul@scylladb.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Pavel Emelyanov
2026-04-10 13:41:12 +03:00
parent 53361358ef
commit debfb147f5

View File

@@ -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<managed_bytes_opt> cluster_describe_statement::range_ownership(const serv
}
future<std::vector<std::vector<managed_bytes_opt>>> 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<managed_bytes_opt> 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)) {