gossip: Simplify get_unreachable_members

_unreachable_endpoints is replicated to call cores. No need to query on
core 0.

This also fixes a bug in storage_proxy::truncate_blocking
which might access _unreachable_endpoints on non-zero cores.
This commit is contained in:
Asias He
2015-10-27 09:25:27 +08:00
parent a9f96d1f5a
commit 6f1db4fb72
3 changed files with 3 additions and 11 deletions

View File

@@ -27,10 +27,9 @@ namespace api {
using namespace json;
void set_gossiper(http_context& ctx, routes& r) {
httpd::gossiper_json::get_down_endpoint.set(r, [](std::unique_ptr<request> req) {
return gms::get_unreachable_members().then([](std::set<gms::inet_address> res) {
return make_ready_future<json::json_return_type>(container_to_vec(res));
});
httpd::gossiper_json::get_down_endpoint.set(r, [] (const_req req) {
auto res = gms::get_local_gossiper().get_unreachable_members();
return container_to_vec(res));
});
httpd::gossiper_json::get_live_endpoint.set(r, [] (const_req req) {

View File

@@ -1464,12 +1464,6 @@ bool gossiper::is_alive(inet_address ep) {
}
}
future<std::set<inet_address>> get_unreachable_members() {
return smp::submit_to(0, [] {
return get_local_gossiper().get_unreachable_members();
});
}
future<int64_t> get_endpoint_downtime(inet_address ep) {
return smp::submit_to(0, [ep] {
return get_local_gossiper().get_endpoint_downtime(ep);

View File

@@ -460,7 +460,6 @@ inline distributed<gossiper>& get_gossiper() {
return _the_gossiper;
}
future<std::set<inet_address>> get_unreachable_members();
future<int64_t> get_endpoint_downtime(inet_address ep);
future<int> get_current_generation_number(inet_address ep);
future<int> get_current_heart_beat_version(inet_address ep);