Skip to content

Commit

Permalink
c/m_manager: converted dispatch_updates_to_cores method to coroutines
Browse files Browse the repository at this point in the history
Signed-off-by: Michał Maślanka <michal@redpanda.com>
  • Loading branch information
mmaslankaprv committed Aug 1, 2024
1 parent e5d1fda commit fc702c8
Showing 1 changed file with 16 additions and 17 deletions.
33 changes: 16 additions & 17 deletions src/v/cluster/members_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -905,26 +905,25 @@ ss::future<> members_manager::set_initial_state(
template<typename Cmd>
ss::future<std::error_code> members_manager::dispatch_updates_to_cores(
model::offset update_offset, Cmd cmd) {
return _members_table
.map([cmd, update_offset](members_table& mt) {
auto results = co_await _members_table.map(
[cmd = std::move(cmd), update_offset](members_table& mt) {
return mt.apply(update_offset, cmd);
})
.then([](std::vector<std::error_code> results) {
auto sentinel = results.front();
auto state_consistent = std::all_of(
results.begin(), results.end(), [sentinel](std::error_code res) {
return sentinel == res;
});

vassert(
state_consistent,
"State inconsistency across shards detected, "
"expected result: {}, have: {}",
sentinel,
results);
});

return sentinel;
auto error = results.front();
auto state_consistent = std::all_of(
results.begin(), results.end(), [error](std::error_code res) {
return error == res;
});

vassert(
state_consistent,
"State inconsistency across shards detected, "
"expected result: {}, have: {}",
error,
results);

co_return error;
}

ss::future<> members_manager::stop() {
Expand Down

0 comments on commit fc702c8

Please sign in to comment.