From 94f2e95a2f5d6058d6926a0089a5b4ac46444034 Mon Sep 17 00:00:00 2001 From: Benny Halevy Date: Tue, 15 Nov 2022 18:00:02 +0200 Subject: [PATCH] view: get_view_natural_endpoint: get topology from erm Get the topology for the effective replication map rather than from the storage_proxy to ensure its synchronized with the natural endpoints. Since there's no preemption between the two calls currently there is no issue, so this is merely a clean up of the code and not supposed to fix anything. Signed-off-by: Benny Halevy --- db/view/view.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/view/view.cc b/db/view/view.cc index 8c08b8393f..4d4ea7f888 100644 --- a/db/view/view.cc +++ b/db/view/view.cc @@ -1394,9 +1394,9 @@ static std::optional get_view_natural_endpoint(const sstring& keyspace_name, const dht::token& base_token, const dht::token& view_token) { auto &db = service::get_local_storage_proxy().local_db(); - auto& topology = service::get_local_storage_proxy().get_token_metadata_ptr()->get_topology(); auto& ks = db.find_keyspace(keyspace_name); auto erm = ks.get_effective_replication_map(); + auto& topology = erm->get_token_metadata_ptr()->get_topology(); auto my_address = utils::fb_utilities::get_broadcast_address(); auto my_datacenter = topology.get_datacenter(); bool network_topology = dynamic_cast(&ks.get_replication_strategy());