Revert "storage_service: remove storage_service::_is_bootstrap_mode."

It will be needed by "storage_service: Reject nodetool cleanup when
there is pending ranges"

This reverts commit dbca327b46.
This commit is contained in:
Asias He
2019-10-23 19:19:30 +08:00
parent dfac542466
commit a39c8d0ed0
3 changed files with 20 additions and 1 deletions

View File

@@ -62,7 +62,9 @@ future<> boot_strapper::bootstrap() {
return streamer->add_ranges(keyspace_name, ranges);
}).then([this, streamer] {
_abort_source.check();
return streamer->stream_async().handle_exception([streamer] (std::exception_ptr eptr) {
return streamer->stream_async().then([streamer] () {
service::get_local_storage_service().finish_bootstrapping();
}).handle_exception([streamer] (std::exception_ptr eptr) {
blogger.warn("Error during bootstrap: {}", eptr);
return make_exception_future<>(std::move(eptr));
});

View File

@@ -715,6 +715,11 @@ void storage_service::join_token_ring(int delay) {
db::system_keyspace::update_tokens(_bootstrap_tokens).get();
bootstrap();
// bootstrap will block until finished
if (_is_bootstrap_mode) {
auto err = format("We are not supposed in bootstrap mode any more");
slogger.warn("{}", err);
throw std::runtime_error(err);
}
} else {
maybe_start_sys_dist_ks();
size_t num_tokens = _db.local().get_config().num_tokens();
@@ -819,6 +824,7 @@ void storage_service::mark_existing_views_as_built() {
// Runs inside seastar::async context
void storage_service::bootstrap() {
_is_bootstrap_mode = true;
if (!db().local().is_replacing()) {
// Wait until we know tokens of existing node before announcing join status.
_gossiper.wait_for_range_setup().get();

View File

@@ -259,6 +259,9 @@ private:
std::optional<inet_address> _removing_node;
/* Are we starting this node in bootstrap mode? */
bool _is_bootstrap_mode;
bool _initialized;
bool _joined = false;
@@ -344,6 +347,10 @@ public:
sstables::sstable_version_types sstables_format() const { return _sstables_format; }
void enable_all_features();
void finish_bootstrapping() {
_is_bootstrap_mode = false;
}
void set_gossip_tokens(const std::unordered_set<dht::token>& local_tokens);
#if 0
@@ -547,6 +554,10 @@ private:
void bootstrap();
public:
bool is_bootstrap_mode() {
return _is_bootstrap_mode;
}
#if 0
public TokenMetadata getTokenMetadata()