diff --git a/service/storage_service.cc b/service/storage_service.cc index f00ddb8254..acbba809bd 100644 --- a/service/storage_service.cc +++ b/service/storage_service.cc @@ -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 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 diff --git a/service/storage_service.hh b/service/storage_service.hh index e55da3e8e3..b9a9bd4698 100644 --- a/service/storage_service.hh +++ b/service/storage_service.hh @@ -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 stream_hints();