raft: Await instead of returning future in wait_for_state_change

The `try-catch` expression is pretty much useless in its current form.
If we return the future, the awaiting will only be performed by the
caller, completely circumventing the exception handling.

As a result, instead of handling `raft::request_aborted` with a proper
error message, the user will face `seastar::abort_requested_exception`
whose message is cryptic at best. It doesn't even point to the root
of the problem.

Fixes SCYLLADB-665

(cherry picked from commit c36623baad)
This commit is contained in:
Dawid Mędrek
2026-02-12 12:47:03 +01:00
parent 3386716217
commit ad5ba4c643

View File

@@ -459,7 +459,7 @@ future<> server_impl::wait_for_state_change(seastar::abort_source* as) {
}
try {
return as ? _state_change_promise->get_shared_future(*as) : _state_change_promise->get_shared_future();
co_await (as ? _state_change_promise->get_shared_future(*as) : _state_change_promise->get_shared_future());
} catch (abort_requested_exception&) {
throw request_aborted(fmt::format(
"Aborted while waiting for state change on server: {}, latest applied entry: {}, current state: {}", _id, _applied_idx, _fsm->current_state()));