From 535b71eba3397dd0ae0e4d118334d9db5b95a98b Mon Sep 17 00:00:00 2001 From: Benny Halevy Date: Tue, 11 Apr 2023 15:57:02 +0300 Subject: [PATCH] view_builder: view_build_statuses: use topology::for_each_node Instead of tmptr->get_endpoint_to_host_id_map_for_reading. Signed-off-by: Benny Halevy --- db/view/view.cc | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/db/view/view.cc b/db/view/view.cc index cd6b5456b5..f4e344cdd0 100644 --- a/db/view/view.cc +++ b/db/view/view.cc @@ -2093,13 +2093,14 @@ future<> view_builder::calculate_shard_build_step(view_builder_init_state& vbi) future> view_builder::view_build_statuses(sstring keyspace, sstring view_name) const { return _sys_dist_ks.view_status(std::move(keyspace), std::move(view_name)).then([] (std::unordered_map status) { - auto endpoint_to_host_id = service::get_local_storage_proxy().get_token_metadata_ptr()->get_endpoint_to_host_id_map_for_reading(); - return boost::copy_range>(endpoint_to_host_id - | boost::adaptors::transformed([&status] (const std::pair& p) { - auto it = status.find(p.second); - auto s = it != status.end() ? std::move(it->second) : "UNKNOWN"; - return std::pair(p.first.to_sstring(), std::move(s)); - })); + std::unordered_map status_map; + const auto& topo = service::get_local_storage_proxy().get_token_metadata_ptr()->get_topology(); + topo.for_each_node([&] (const locator::node *node) { + auto it = status.find(node->host_id()); + auto s = it != status.end() ? std::move(it->second) : "UNKNOWN"; + status_map.emplace(node->endpoint().to_sstring(), std::move(s)); + }); + return status_map; }); }