locator: replication strategies: use locator::topology rather than fb_utilities
Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
This commit is contained in:
@@ -11,7 +11,6 @@
|
||||
|
||||
#include "locator/everywhere_replication_strategy.hh"
|
||||
#include "utils/class_registrator.hh"
|
||||
#include "utils/fb_utilities.hh"
|
||||
#include "locator/token_metadata.hh"
|
||||
|
||||
namespace locator {
|
||||
@@ -23,7 +22,7 @@ everywhere_replication_strategy::everywhere_replication_strategy(const replicati
|
||||
|
||||
future<endpoint_set> everywhere_replication_strategy::calculate_natural_endpoints(const token& search_token, const token_metadata& tm) const {
|
||||
if (tm.sorted_tokens().empty()) {
|
||||
endpoint_set result{inet_address_vector_replica_set({utils::fb_utilities::get_broadcast_address()})};
|
||||
endpoint_set result{inet_address_vector_replica_set({tm.get_topology().my_address()})};
|
||||
return make_ready_future<endpoint_set>(std::move(result));
|
||||
}
|
||||
const auto& all_endpoints = tm.get_all_endpoints();
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#include <algorithm>
|
||||
#include "local_strategy.hh"
|
||||
#include "utils/class_registrator.hh"
|
||||
#include "utils/fb_utilities.hh"
|
||||
|
||||
|
||||
namespace locator {
|
||||
@@ -20,7 +19,7 @@ local_strategy::local_strategy(const replication_strategy_config_options& config
|
||||
}
|
||||
|
||||
future<endpoint_set> local_strategy::calculate_natural_endpoints(const token& t, const token_metadata& tm) const {
|
||||
return make_ready_future<endpoint_set>(endpoint_set({utils::fb_utilities::get_broadcast_address()}));
|
||||
return make_ready_future<endpoint_set>(endpoint_set({tm.get_topology().my_address()}));
|
||||
}
|
||||
|
||||
void local_strategy::validate_options(const gms::feature_service&) const {
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
|
||||
#include "locator/network_topology_strategy.hh"
|
||||
#include "locator/load_sketch.hh"
|
||||
#include "utils/fb_utilities.hh"
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include "utils/hash.hh"
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#include "gms/inet_address.hh"
|
||||
#include "locator/types.hh"
|
||||
#include "utils/UUID_gen.hh"
|
||||
#include "utils/fb_utilities.hh"
|
||||
#include "utils/sequenced_set.hh"
|
||||
#include "locator/network_topology_strategy.hh"
|
||||
#include "test/lib/scylla_test_case.hh"
|
||||
@@ -704,8 +703,10 @@ void generate_topology(topology& topo, const std::unordered_map<sstring, size_t>
|
||||
}
|
||||
|
||||
SEASTAR_THREAD_TEST_CASE(testCalculateEndpoints) {
|
||||
utils::fb_utilities::set_broadcast_address(gms::inet_address("localhost"));
|
||||
utils::fb_utilities::set_broadcast_rpc_address(gms::inet_address("localhost"));
|
||||
locator::token_metadata::config tm_cfg;
|
||||
auto my_address = gms::inet_address("localhost");
|
||||
tm_cfg.topo_cfg.this_endpoint = my_address;
|
||||
tm_cfg.topo_cfg.this_cql_address = my_address;
|
||||
|
||||
constexpr size_t NODES = 100;
|
||||
constexpr size_t VNODES = 64;
|
||||
@@ -726,7 +727,7 @@ SEASTAR_THREAD_TEST_CASE(testCalculateEndpoints) {
|
||||
|
||||
for (size_t run = 0; run < RUNS; ++run) {
|
||||
semaphore sem(1);
|
||||
shared_token_metadata stm([&sem] () noexcept { return get_units(sem, 1); }, locator::token_metadata::config{});
|
||||
shared_token_metadata stm([&sem] () noexcept { return get_units(sem, 1); }, tm_cfg);
|
||||
|
||||
std::unordered_set<dht::token> random_tokens;
|
||||
while (random_tokens.size() < nodes.size() * VNODES) {
|
||||
@@ -813,8 +814,10 @@ void topology::test_compare_endpoints(const inet_address& address, const inet_ad
|
||||
} // namespace locator
|
||||
|
||||
SEASTAR_THREAD_TEST_CASE(test_topology_compare_endpoints) {
|
||||
utils::fb_utilities::set_broadcast_address(gms::inet_address("localhost"));
|
||||
utils::fb_utilities::set_broadcast_rpc_address(gms::inet_address("localhost"));
|
||||
locator::token_metadata::config tm_cfg;
|
||||
auto my_address = gms::inet_address("localhost");
|
||||
tm_cfg.topo_cfg.this_endpoint = my_address;
|
||||
tm_cfg.topo_cfg.this_cql_address = my_address;
|
||||
|
||||
constexpr size_t NODES = 10;
|
||||
|
||||
@@ -836,7 +839,7 @@ SEASTAR_THREAD_TEST_CASE(test_topology_compare_endpoints) {
|
||||
auto bogus_address = make_address(NODES + 1);
|
||||
|
||||
semaphore sem(1);
|
||||
shared_token_metadata stm([&sem] () noexcept { return get_units(sem, 1); }, locator::token_metadata::config{});
|
||||
shared_token_metadata stm([&sem] () noexcept { return get_units(sem, 1); }, tm_cfg);
|
||||
stm.mutate_token_metadata([&] (token_metadata& tm) {
|
||||
auto& topo = tm.get_topology();
|
||||
generate_topology(topo, datacenters, nodes);
|
||||
|
||||
Reference in New Issue
Block a user