Skip to content

Commit

Permalink
storage_service: is_replacing: rely directly on config options
Browse files Browse the repository at this point in the history
Rather than on get_replace_address, before we remove the latter.

Signed-off-by: Benny Halevy <[email protected]>
  • Loading branch information
bhalevy committed Jan 13, 2023
1 parent 7282d58 commit 17f70e4
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions service/storage_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -188,12 +188,27 @@ std::optional<gms::inet_address> storage_service::get_replace_address() {
}

bool storage_service::is_replacing() {
sstring replace_address_first_boot = _db.local().get_config().replace_address_first_boot();
if (!replace_address_first_boot.empty() && _sys_ks.local().bootstrap_complete()) {
const auto& cfg = _db.local().get_config();
if (!cfg.replace_node_first_boot().empty()) {
if (_sys_ks.local().bootstrap_complete()) {
slogger.info("Replace node on first boot requested; this node is already bootstrapped");
return false;
}
return true;
}
if (!cfg.replace_address_first_boot().empty()) {
if (_sys_ks.local().bootstrap_complete()) {
slogger.info("Replace address on first boot requested; this node is already bootstrapped");
return false;
}
return bool(get_replace_address());
}
return true;
}
// Returning true if cfg.replace_address is provided
// will trigger an exception down the road if bootstrap_complete(),
// as it is an error to use this option post bootstrap.
// That said, we should just stop supporting it and force users
// to move to the new, replace_node_first_boot config option.
return !cfg.replace_address().empty();
}

bool storage_service::is_first_node() {
Expand Down

0 comments on commit 17f70e4

Please sign in to comment.