storage_proxy: filter out natural endpoints from pending endpoint

If request comes after natural endpoint was updated to contain node A,
but A was not yet removed from pending endpoints it will be in both and
write request logic cannot handle this properly. Filter nodes which are
already in natural endpoint from pending endpoint to fix this.

Fixes #539.
This commit is contained in:
Gleb Natapov
2015-11-25 15:48:14 +02:00
committed by Pekka Enberg
parent cf7541020f
commit d9d8f87c1b

View File

@@ -767,6 +767,12 @@ storage_proxy::create_write_response_handler(const mutation& m, db::consistency_
std::vector<gms::inet_address> pending_endpoints =
get_local_storage_service().get_token_metadata().pending_endpoints_for(m.token(), keyspace_name);
// filter out naturale_endpoints from pending_endpoint if later is not yet updated during node join
auto itend = boost::range::remove_if(pending_endpoints, [&natural_endpoints] (gms::inet_address& p) {
return boost::range::find(natural_endpoints, p) != natural_endpoints.end();
});
pending_endpoints.erase(itend, pending_endpoints.end());
auto all = boost::range::join(natural_endpoints, pending_endpoints);
if (std::find_if(all.begin(), all.end(), std::bind1st(std::mem_fn(&storage_proxy::cannot_hint), this)) != all.end()) {