Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop recovery when follower offset was already updated #15049

Merged
merged 2 commits into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/v/raft/consensus.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1158,10 +1158,16 @@ ss::future<std::error_code> consensus::replace_configuration(
model::revision_id new_revision,
std::optional<model::offset> learner_start_offset) {
return change_configuration(
[nodes = std::move(nodes), new_revision, learner_start_offset](
[this, nodes = std::move(nodes), new_revision, learner_start_offset](
group_configuration current) mutable {
auto old = current;
current.set_version(raft::group_configuration::v_5);
current.replace(nodes, new_revision, learner_start_offset);
vlog(
_ctxlog.debug,
"Replacing current configuration: {} with new configuration: {}",
old,
current);

return result<group_configuration>{std::move(current)};
});
Expand Down
12 changes: 12 additions & 0 deletions src/v/raft/recovery_stm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,18 @@ ss::future<> recovery_stm::replicate(
_stop_requested = true;
return ss::now();
}
if (meta.value()->expected_log_end_offset >= _last_batch_offset) {
vlog(
_ctxlog.trace,
"follower expected log end offset is already updated, stopping "
"recovery. Expected log end offset: {}, recovery range last offset: "
"{}",
meta.value()->expected_log_end_offset,
_last_batch_offset);

_stop_requested = true;
return ss::now();
}
rockwotj marked this conversation as resolved.
Show resolved Hide resolved
/**
* Update follower expected log end. It is equal to the last batch in a set
* of batches read for this recovery round.
Expand Down