mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-26 11:30:36 +00:00
abstract_replication_strategy::get_natural_endpoints() does some token calculations before calling strategy specific calculate_natural_endpoints(), but system table may be read before token metadata (needed for token calculations) is ready. Fix that by specializing local_strategy's get_natural_endpoints() to skip token calculation.
33 lines
1.1 KiB
C++
33 lines
1.1 KiB
C++
/*
|
|
* Copyright (C) 2015 Cloudius Systems, Ltd.
|
|
*/
|
|
|
|
#include <algorithm>
|
|
#include "local_strategy.hh"
|
|
#include "utils/class_registrator.hh"
|
|
#include "utils/fb_utilities.hh"
|
|
|
|
|
|
namespace locator {
|
|
|
|
local_strategy::local_strategy(const sstring& keyspace_name, token_metadata& token_metadata, snitch_ptr& snitch, const std::map<sstring, sstring>& config_options) :
|
|
abstract_replication_strategy(keyspace_name, token_metadata, snitch, config_options, replication_strategy_type::local) {}
|
|
|
|
std::vector<inet_address> local_strategy::get_natural_endpoints(const token& t) {
|
|
return calculate_natural_endpoints(t);
|
|
}
|
|
|
|
std::vector<inet_address> local_strategy::calculate_natural_endpoints(const token& t) {
|
|
return std::vector<inet_address>({utils::fb_utilities::get_broadcast_address()});
|
|
}
|
|
|
|
size_t local_strategy::get_replication_factor() const {
|
|
return 1;
|
|
}
|
|
|
|
using registry = class_registrator<abstract_replication_strategy, local_strategy, const sstring&, token_metadata&, snitch_ptr&, const std::map<sstring, sstring>&>;
|
|
static registry registrator("org.apache.cassandra.locator.LocalStrategy");
|
|
static registry registrator_short_name("LocalStrategy");
|
|
|
|
}
|