locator: effective_replication_map: Abstract get_pending_endpoints()

This commit is contained in:
Tomasz Grabiec
2023-03-21 17:20:42 +01:00
parent 7b01fe8742
commit 1343bfa708
3 changed files with 7 additions and 2 deletions

View File

@@ -103,6 +103,10 @@ inet_address_vector_replica_set effective_replication_map::get_natural_endpoints
return natural_endpoints;
}
inet_address_vector_topology_change effective_replication_map::get_pending_endpoints(const token& search_token, const sstring& ks_name) const {
return _tmptr->pending_endpoints_for(search_token, ks_name);
}
void abstract_replication_strategy::validate_replication_factor(sstring rf)
{
if (rf.empty() || std::any_of(rf.begin(), rf.end(), [] (char c) {return !isdigit(c);})) {

View File

@@ -205,6 +205,7 @@ public:
inet_address_vector_replica_set get_natural_endpoints(const token& search_token) const;
stop_iteration for_each_natural_endpoint_until(const token& search_token, const noncopyable_function<stop_iteration(const inet_address&)>& func) const;
inet_address_vector_replica_set get_natural_endpoints_without_node_being_replaced(const token& search_token) const;
inet_address_vector_topology_change get_pending_endpoints(const token& search_token, const sstring& ks_name) const;
// get_ranges() returns the list of ranges held by the given endpoint.
// The list is sorted, and its elements are non overlapping and non wrap-around.

View File

@@ -2846,7 +2846,7 @@ storage_proxy::create_write_response_handler_helper(schema_ptr s, const dht::tok
replica::keyspace& ks = _db.local().find_keyspace(keyspace_name);
auto erm = ks.get_effective_replication_map();
inet_address_vector_replica_set natural_endpoints = erm->get_natural_endpoints_without_node_being_replaced(token);
inet_address_vector_topology_change pending_endpoints = erm->get_token_metadata_ptr()->pending_endpoints_for(token, keyspace_name);
inet_address_vector_topology_change pending_endpoints = erm->get_pending_endpoints(token, keyspace_name);
slogger.trace("creating write handler for token: {} natural: {} pending: {}", token, natural_endpoints, pending_endpoints);
tracing::trace(tr_state, "Creating write handler for token: {} natural: {} pending: {}", token, natural_endpoints ,pending_endpoints);
@@ -3209,7 +3209,7 @@ future<> storage_proxy::mutate_counters(Range&& mutations, db::consistency_level
storage_proxy::paxos_participants
storage_proxy::get_paxos_participants(const sstring& ks_name, const locator::effective_replication_map& erm, const dht::token &token, db::consistency_level cl_for_paxos) {
inet_address_vector_replica_set natural_endpoints = erm.get_natural_endpoints_without_node_being_replaced(token);
inet_address_vector_topology_change pending_endpoints = erm.get_token_metadata_ptr()->pending_endpoints_for(token, ks_name);
inet_address_vector_topology_change pending_endpoints = erm.get_pending_endpoints(token, ks_name);
if (cl_for_paxos == db::consistency_level::LOCAL_SERIAL) {
auto local_dc_filter = erm.get_topology().get_local_dc_filter();