effective_replication_map: make get_range_addresses asynchronous

So it may yield, preenting reactor stalls as seen in #11005.

Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
This commit is contained in:
Benny Halevy
2022-07-10 17:58:43 +03:00
parent 9b2af3f542
commit 91ab8ee1c3
5 changed files with 12 additions and 9 deletions

View File

@@ -256,7 +256,7 @@ abstract_replication_strategy::get_address_ranges(const token_metadata& tm, inet
co_return ret;
}
std::unordered_map<dht::token_range, inet_address_vector_replica_set>
future<std::unordered_map<dht::token_range, inet_address_vector_replica_set>>
effective_replication_map::get_range_addresses() const {
const token_metadata& tm = *_tmptr;
std::unordered_map<dht::token_range, inet_address_vector_replica_set> ret;
@@ -265,8 +265,9 @@ effective_replication_map::get_range_addresses() const {
for (auto& r : ranges) {
ret.emplace(r, eps);
}
co_await coroutine::maybe_yield();
}
return ret;
co_return ret;
}
future<std::unordered_map<dht::token_range, inet_address_vector_replica_set>>

View File

@@ -222,7 +222,7 @@ public:
// Note: must be called after token_metadata has been initialized.
dht::token_range_vector get_primary_ranges_within_dc(inet_address ep) const;
std::unordered_map<dht::token_range, inet_address_vector_replica_set>
future<std::unordered_map<dht::token_range, inet_address_vector_replica_set>>
get_range_addresses() const;
private: