From 951c0d192bafe92db997876f6a91c3a1bf3c88df Mon Sep 17 00:00:00 2001 From: Asias He Date: Tue, 11 Aug 2015 11:30:12 +0800 Subject: [PATCH] storage_service: Enable _is_survey_mode logic in join_token_ring --- service/storage_service.cc | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/service/storage_service.cc b/service/storage_service.cc index 5a2d7c5072..f5139456fa 100644 --- a/service/storage_service.cc +++ b/service/storage_service.cc @@ -287,30 +287,28 @@ future<> storage_service::join_token_ring(int delay) { } } } - set_tokens(_bootstrap_tokens).get(); #if 0 // if we don't have system_traces keyspace at this point, then create it manually if (Schema.instance.getKSMetaData(TraceKeyspace.NAME) == null) MigrationManager.announceNewKeyspace(TraceKeyspace.definition(), 0, false); +#endif - if (!_is_survey_mode) - { + if (!_is_survey_mode) { // start participating in the ring. - SystemKeyspace.setBootstrapState(SystemKeyspace.BootstrapState.COMPLETED); - set_tokens(_bootstrap_tokens); + //SystemKeyspace.setBootstrapState(SystemKeyspace.BootstrapState.COMPLETED); + set_tokens(_bootstrap_tokens).get(); // remove the existing info about the replaced node. - if (!current.isEmpty()) - for (InetAddress existing : current) - Gossiper.instance.replacedEndpoint(existing); - assert _token_metadata.sortedTokens().size() > 0; - - Auth.setup(); - } - else - { + if (!current.empty()) { + auto& gossiper = gms::get_local_gossiper(); + for (auto existing : current) { + gossiper.replaced_endpoint(existing); + } + } + assert(_token_metadata.sorted_tokens().size() > 0); + //Auth.setup(); + } else { logger.info("Startup complete, but write survey mode is active, not becoming an active ring member. Use JMX (StorageService->joinRing()) to finalize ring joining."); } -#endif }); }