view: Get topology via database tokens

The view_builder::view_build_statuses() needs topology to walk its
nodes. Now it gets one from global proxy via its token metadata, but
database also has tokens and view_builder has reference to database.

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
This commit is contained in:
Pavel Emelyanov
2023-04-20 12:52:21 +03:00
parent 403463d7eb
commit bda2aea5be

View File

@@ -2096,7 +2096,7 @@ future<std::unordered_map<sstring, sstring>>
view_builder::view_build_statuses(sstring keyspace, sstring view_name) const { view_builder::view_build_statuses(sstring keyspace, sstring view_name) const {
std::unordered_map<locator::host_id, sstring> status = co_await _sys_dist_ks.view_status(std::move(keyspace), std::move(view_name)); std::unordered_map<locator::host_id, sstring> status = co_await _sys_dist_ks.view_status(std::move(keyspace), std::move(view_name));
std::unordered_map<sstring, sstring> status_map; std::unordered_map<sstring, sstring> status_map;
const auto& topo = service::get_local_storage_proxy().get_token_metadata_ptr()->get_topology(); const auto& topo = _db.get_token_metadata().get_topology();
topo.for_each_node([&] (const locator::node *node) { topo.for_each_node([&] (const locator::node *node) {
auto it = status.find(node->host_id()); auto it = status.find(node->host_id());
auto s = it != status.end() ? std::move(it->second) : "UNKNOWN"; auto s = it != status.end() ? std::move(it->second) : "UNKNOWN";