locator::i_endpoint_snitch: align the _prefer_local parameter with _my_dc and _my_rack

Adjust the interface and distribution of prefer_local parameter read
from a snitch property file with the rest of similar parameters (e.g. dc and rack):
they are read and their values are distributed (copied) across all shards'
instances.

Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
This commit is contained in:
Vlad Zolotarov
2015-11-02 11:09:32 +02:00
parent 5042f3c952
commit 5da4e62a59
4 changed files with 7 additions and 1 deletions

View File

@@ -214,6 +214,7 @@ future<> gossiping_property_file_snitch::reload_configuration() {
if (engine().cpu_id() != _file_reader_cpu_id) {
local_s->set_my_dc(_my_dc);
local_s->set_my_rack(_my_rack);
local_s->set_prefer_local(_prefer_local);
}
}).then([this] {
return seastar::async([this] {

View File

@@ -136,7 +136,6 @@ private:
timer<> _file_reader;
std::experimental::optional<timespec> _last_file_mod;
std::istringstream _istrm;
bool _prefer_local = false;
bool _file_reader_runs = false;
unsigned _file_reader_cpu_id;
shared_ptr<reconnectable_snitch_helper> _reconnectable_helper;

View File

@@ -163,6 +163,10 @@ private:
_my_rack = new_rack;
}
virtual void set_prefer_local(bool prefer_local) override {
_prefer_local = prefer_local;
}
void parse_property_file();
protected:

View File

@@ -145,6 +145,7 @@ public:
// noop by default
virtual void set_my_dc(const sstring& new_dc) {};
virtual void set_my_rack(const sstring& new_rack) {};
virtual void set_prefer_local(bool prefer_local) {};
virtual void set_local_private_addr(const sstring& addr_str) {};
static distributed<snitch_ptr>& snitch_instance() {
@@ -429,6 +430,7 @@ private:
protected:
sstring _my_dc;
sstring _my_rack;
bool _prefer_local = false;
};
} // namespace locator