diff --git a/service/migration_manager.cc b/service/migration_manager.cc index 46df7295ac..f7355b3246 100644 --- a/service/migration_manager.cc +++ b/service/migration_manager.cc @@ -132,10 +132,15 @@ future<> migration_manager::schedule_schema_pull(const gms::inet_address& endpoi return make_ready_future<>(); } -bool migration_manager::is_ready_for_bootstrap() { +bool migration_manager::have_schema_agreement() { + const auto known_endpoints = gms::get_local_gossiper().endpoint_state_map; + if (known_endpoints.size() == 1) { + // Us. + return true; + } auto our_version = get_local_storage_proxy().get_db().local().get_version(); bool match = false; - for (auto& x : gms::get_local_gossiper().endpoint_state_map) { + for (auto& x : known_endpoints) { auto& endpoint = x.first; auto& eps = x.second; if (endpoint == utils::fb_utilities::get_broadcast_address() || !eps.is_alive()) { diff --git a/service/migration_manager.hh b/service/migration_manager.hh index 5af2ee8cfb..52ed2abf05 100644 --- a/service/migration_manager.hh +++ b/service/migration_manager.hh @@ -144,7 +144,10 @@ public: future<> stop(); - bool is_ready_for_bootstrap(); + /** + * Known peers in the cluster have the same schema version as us. + */ + bool have_schema_agreement(); void init_messaging_service(); private: diff --git a/service/storage_service.cc b/service/storage_service.cc index 316e4c4761..f8cc9ac9fa 100644 --- a/service/storage_service.cc +++ b/service/storage_service.cc @@ -413,7 +413,7 @@ void storage_service::join_token_ring(int delay) { } // if our schema hasn't matched yet, keep sleeping until it does // (post CASSANDRA-1391 we don't expect this to be necessary very often, but it doesn't hurt to be careful) - while (!get_local_migration_manager().is_ready_for_bootstrap()) { + while (!get_local_migration_manager().have_schema_agreement()) { set_mode(mode::JOINING, "waiting for schema information to complete", true); sleep(std::chrono::seconds(1)).get(); } @@ -442,7 +442,7 @@ void storage_service::join_token_ring(int delay) { } // Check the schema and pending range again - while (!get_local_migration_manager().is_ready_for_bootstrap()) { + while (!get_local_migration_manager().have_schema_agreement()) { set_mode(mode::JOINING, "waiting for schema information to complete", true); sleep(std::chrono::seconds(1)).get(); }