From 48edc4f839cf5f22b27d14f57330324230ceb291 Mon Sep 17 00:00:00 2001 From: Michal Maslanka Date: Tue, 5 Jul 2022 10:08:32 +0200 Subject: [PATCH] r/consensus: try updating leader commit index after aborting config change When configuration change is aborted we append simple configuration entry to each raft group member log. If node is a leader we must try to update the committed index. For single replica raft groups that is the only way to make the committed offset progress and finish reconfiguration. Updating committed offset is possible for single replica raft groups as the node is the only source of truth for all raft decisions hence an entry appended to leader log may immediately be committed. Fixes: #5338 Signed-off-by: Michal Maslanka --- src/v/raft/consensus.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/v/raft/consensus.cc b/src/v/raft/consensus.cc index e9c7c4efa6dd..24ea314f6edf 100644 --- a/src/v/raft/consensus.cc +++ b/src/v/raft/consensus.cc @@ -1069,6 +1069,12 @@ consensus::abort_configuration_change(model::revision_id revision) { append_result.base_offset); // flush log as all configuration changes must eventually be committed. co_await flush_log(); + // if current node is a leader make sure we will try to update committed + // index, it may be required for single participant raft groups + if (is_leader()) { + maybe_update_majority_replicated_index(); + maybe_update_leader_commit_idx(); + } co_return errc::success; }