storage_service: Implement start_leaving

This commit is contained in:
Asias He
2015-10-22 10:28:51 +08:00
parent 513ab87b47
commit ce6dd0f8f8
2 changed files with 13 additions and 12 deletions

View File

@@ -1455,7 +1455,7 @@ future<> storage_service::decommission() {
}
logger.debug("DECOMMISSIONING");
// FIXME: startLeaving();
start_leaving().get();
// FIXME: long timeout = Math.max(RING_DELAY, BatchlogManager.instance.getBatchlogTimeout());
long timeout = get_ring_delay();
set_mode(mode::LEAVING, sprint("sleeping %s ms for batch processing and pending range setup", timeout), true);
@@ -2019,4 +2019,11 @@ future<streaming::stream_state> storage_service::stream_hints() {
}
}
future<> storage_service::start_leaving() {
auto& gossiper = gms::get_local_gossiper();
gossiper.add_local_application_state(application_state::STATUS, value_factory.leaving(get_local_tokens()));
_token_metadata.add_leaving_endpoint(get_broadcast_address());
return get_local_pending_range_calculator_service().update();
}
} // namespace service

View File

@@ -1878,21 +1878,15 @@ public:
FBUtilities.sortSampledKeys(keys, range);
return keys;
}
/**
* Broadcast leaving status and update local _token_metadata accordingly
*/
private void startLeaving()
{
Gossiper.instance.addLocalApplicationState(ApplicationState.STATUS, valueFactory.leaving(getLocalTokens()));
_token_metadata.addLeavingEndpoint(FBUtilities.getBroadcastAddress());
PendingRangeCalculatorService.instance.update();
}
#endif
public:
future<> decommission();
private:
/**
* Broadcast leaving status and update local _token_metadata accordingly
*/
future<> start_leaving();
void leave_ring();
void unbootstrap();
future<streaming::stream_state> stream_hints();