Skip to content

Commit

Permalink
storage_service: restore_replica_count: undefer stop_status_checker
Browse files Browse the repository at this point in the history
Now that all exceptions in the rest of the function
are swallowed, just execute the stop_status_checker
deferred action serially before returning, on the
wau to coroutinizing restore_replica_count (since
we can't co_await status_checker inside the deferred
action).

Signed-off-by: Benny Halevy <[email protected]>
  • Loading branch information
bhalevy committed Jan 4, 2023
1 parent 788ecb7 commit d1eadc3
Showing 1 changed file with 13 additions and 16 deletions.
29 changes: 13 additions & 16 deletions service/storage_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2966,22 +2966,6 @@ future<> storage_service::restore_replica_count(inet_address endpoint, inet_addr
}
};
auto status_checker = check_status_loop();
auto stop_status_checker = defer([endpoint, &status_checker, &as] () mutable {
try {
slogger.info("restore_replica_count: Started to stop status checker for removing node {}", endpoint);
if (!as.abort_requested()) {
as.request_abort();
}
status_checker.get();
} catch (const seastar::sleep_aborted& ignored) {
slogger.debug("restore_replica_count: Got sleep_abort to stop status checker for removing node {}: {}", endpoint, ignored);
} catch (...) {
slogger.warn("restore_replica_count: Found error in status checker for removing node {}: {}",
endpoint, std::current_exception());
}
slogger.info("restore_replica_count: Finished to stop status checker for removing node {}", endpoint);
});

std::exception_ptr ex;
try {
streamer->stream_async().get();
Expand All @@ -2999,6 +2983,19 @@ future<> storage_service::restore_replica_count(inet_address endpoint, inet_addr
ex = std::move(ex2);
}
}
try {
slogger.info("restore_replica_count: Started to stop status checker for removing node {}", endpoint);
if (!as.abort_requested()) {
as.request_abort();
}
status_checker.get();
} catch (const seastar::sleep_aborted& ignored) {
slogger.debug("restore_replica_count: Got sleep_abort to stop status checker for removing node {}: {}", endpoint, ignored);
} catch (...) {
slogger.warn("restore_replica_count: Found error in status checker for removing node {}: {}",
endpoint, std::current_exception());
}
slogger.info("restore_replica_count: Finished to stop status checker for removing node {}", endpoint);
if (ex) {
std::rethrow_exception(std::move(ex));
}
Expand Down

0 comments on commit d1eadc3

Please sign in to comment.