abstract_replication_strategy: get rid of do_calculate_natural_endpoints

It is no longer in use.

And with it, the virtual calculate_natural_endpoint_sync method
of which it was the only caller.

Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
This commit is contained in:
Benny Halevy
2021-09-22 17:32:27 +03:00
parent cbe58345b9
commit bdce6f93ca
10 changed files with 0 additions and 69 deletions

View File

@@ -73,14 +73,6 @@ void abstract_replication_strategy::validate_replication_strategy(const sstring&
}
}
inet_address_vector_replica_set abstract_replication_strategy::do_calculate_natural_endpoints(const token& search_token, const token_metadata& tm, can_yield can_yield) const {
if (!can_yield) {
return calculate_natural_endpoints_sync(search_token, tm);
} else {
return calculate_natural_endpoints(search_token, tm).get0();
}
}
inet_address_vector_replica_set abstract_replication_strategy::get_natural_endpoints(const token& search_token, const effective_replication_map& erm) const {
const token& key_token = erm.get_token_metadata_ptr()->first_token(search_token);
auto res = erm.get_replication_map().find(key_token);

View File

@@ -118,13 +118,6 @@ public:
// Use the token_metadata provided by the caller instead of _token_metadata
future<dht::token_range_vector> get_ranges(inet_address ep, token_metadata_ptr tmptr) const;
private:
// FIXME: temporary, until all users are converted to use the async version
virtual inet_address_vector_replica_set calculate_natural_endpoints_sync(const token& search_token, const token_metadata& tm) const = 0;
protected:
inet_address_vector_replica_set do_calculate_natural_endpoints(const token& search_token, const token_metadata& tm, can_yield = can_yield::no) const;
public:
future<std::unordered_multimap<inet_address, dht::token_range>> get_address_ranges(const token_metadata& tm) const;
future<std::unordered_multimap<inet_address, dht::token_range>> get_address_ranges(const token_metadata& tm, inet_address endpoint) const;

View File

@@ -47,10 +47,6 @@ namespace locator {
everywhere_replication_strategy::everywhere_replication_strategy(const shared_token_metadata& token_metadata, snitch_ptr& snitch, const replication_strategy_config_options& config_options) :
abstract_replication_strategy(token_metadata, snitch, config_options, replication_strategy_type::everywhere_topology) {}
inet_address_vector_replica_set everywhere_replication_strategy::calculate_natural_endpoints_sync(const token& search_token, const token_metadata& tm) const {
return boost::copy_range<inet_address_vector_replica_set>(tm.get_all_endpoints());
}
future<inet_address_vector_replica_set> everywhere_replication_strategy::calculate_natural_endpoints(const token& search_token, const token_metadata& tm) const {
return make_ready_future<inet_address_vector_replica_set>(boost::copy_range<inet_address_vector_replica_set>(tm.get_all_endpoints()));
}

View File

@@ -46,7 +46,6 @@ class everywhere_replication_strategy : public abstract_replication_strategy {
public:
everywhere_replication_strategy(const shared_token_metadata& token_metadata, snitch_ptr& snitch, const replication_strategy_config_options& config_options);
virtual inet_address_vector_replica_set calculate_natural_endpoints_sync(const token& search_token, const token_metadata& tm) const override;
virtual future<inet_address_vector_replica_set> calculate_natural_endpoints(const token& search_token, const token_metadata& tm) const override;
virtual void validate_options() const override { /* noop */ }

View File

@@ -30,10 +30,6 @@ namespace locator {
local_strategy::local_strategy(const shared_token_metadata& token_metadata, snitch_ptr& snitch, const replication_strategy_config_options& config_options) :
abstract_replication_strategy(token_metadata, snitch, config_options, replication_strategy_type::local) {}
inet_address_vector_replica_set local_strategy::calculate_natural_endpoints_sync(const token& t, const token_metadata& tm) const {
return inet_address_vector_replica_set({utils::fb_utilities::get_broadcast_address()});
}
future<inet_address_vector_replica_set> local_strategy::calculate_natural_endpoints(const token& t, const token_metadata& tm) const {
return make_ready_future<inet_address_vector_replica_set>(inet_address_vector_replica_set({utils::fb_utilities::get_broadcast_address()}));
}

View File

@@ -40,7 +40,6 @@ public:
virtual ~local_strategy() {};
virtual size_t get_replication_factor() const override;
virtual inet_address_vector_replica_set calculate_natural_endpoints_sync(const token& search_token, const token_metadata& tm) const override;
virtual future<inet_address_vector_replica_set> calculate_natural_endpoints(const token& search_token, const token_metadata& tm) const override;
virtual void validate_options() const override;

View File

@@ -271,22 +271,6 @@ public:
}
};
inet_address_vector_replica_set
network_topology_strategy::calculate_natural_endpoints_sync(
const token& search_token, const token_metadata& tm) const {
natural_endpoints_tracker tracker(tm, _dc_rep_factor);
for (auto& next : tm.ring_range(search_token)) {
inet_address ep = *tm.get_endpoint(next);
if (tracker.add_endpoint_and_check_if_done(ep)) {
break;
}
}
return boost::copy_range<inet_address_vector_replica_set>(tracker.replicas().get_vector());
}
future<inet_address_vector_replica_set>
network_topology_strategy::calculate_natural_endpoints(
const token& search_token, const token_metadata& tm) const {

View File

@@ -74,8 +74,6 @@ protected:
* calculate endpoints in one pass through the tokens by tracking our
* progress in each DC, rack etc.
*/
virtual inet_address_vector_replica_set calculate_natural_endpoints_sync(
const token& search_token, const token_metadata& tm) const override;
virtual future<inet_address_vector_replica_set> calculate_natural_endpoints(
const token& search_token, const token_metadata& tm) const override;

View File

@@ -46,31 +46,6 @@ simple_strategy::simple_strategy(const shared_token_metadata& token_metadata, sn
}
}
inet_address_vector_replica_set simple_strategy::calculate_natural_endpoints_sync(const token& t, const token_metadata& tm) const {
const std::vector<token>& tokens = tm.sorted_tokens();
if (tokens.empty()) {
return inet_address_vector_replica_set();
}
size_t replicas = get_replication_factor();
utils::sequenced_set<inet_address> endpoints;
endpoints.reserve(replicas);
for (auto& token : tm.ring_range(t)) {
if (endpoints.size() == replicas) {
break;
}
auto ep = tm.get_endpoint(token);
assert(ep);
endpoints.push_back(*ep);
}
return boost::copy_range<inet_address_vector_replica_set>(endpoints.get_vector());
}
future<inet_address_vector_replica_set> simple_strategy::calculate_natural_endpoints(const token& t, const token_metadata& tm) const {
const std::vector<token>& tokens = tm.sorted_tokens();

View File

@@ -39,7 +39,6 @@ public:
return true;
}
virtual inet_address_vector_replica_set calculate_natural_endpoints_sync(const token& search_token, const token_metadata& tm) const override;
virtual future<inet_address_vector_replica_set> calculate_natural_endpoints(const token& search_token, const token_metadata& tm) const override;
private:
size_t _replication_factor = 1;