Skip to content

Commit

Permalink
r/consensus: wait for follower responses to take effect
Browse files Browse the repository at this point in the history
Grab `_op_lock` in `consensus::lineraizable_barrier` to wait for
follower replies to take effect. This makes linearizable_barrier more
strict as before returning result leader waits for the follower replies
to be processed.

Signed-off-by: Michal Maslanka <michal@redpanda.com>
  • Loading branch information
mmaslankaprv committed Aug 31, 2023
1 parent 4fdc371 commit 98652a8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/v/raft/consensus.cc
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,9 @@ ss::future<result<model::offset>> consensus::linearizable_barrier() {
} catch (const ss::broken_condition_variable& e) {
co_return ret_t(make_error_code(errc::shutting_down));
}

// grab an oplock to serialize state updates i.e. wait for all updates in
// the state that were caused by follower replies
auto units = co_await _op_lock.get_units();
// term have changed, not longer a leader
if (term != _term) {
co_return ret_t(make_error_code(errc::not_leader));
Expand Down

0 comments on commit 98652a8

Please sign in to comment.