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

[v23.2.x] Improved handling of truncation with ACKS=1 #16530

Merged
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
9 changes: 6 additions & 3 deletions src/v/raft/consensus.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1910,11 +1910,11 @@ consensus::do_append_entries(append_entries_request&& r) {

// section 3
if (request_metadata.prev_log_index < last_log_offset) {
if (unlikely(request_metadata.prev_log_index < _commit_index)) {
if (unlikely(request_metadata.prev_log_index < last_visible_index())) {
reply.result = append_entries_reply::status::success;
// clamp dirty offset to the current commit index not to allow
// leader reasoning about follower log beyond that point
reply.last_dirty_log_index = _commit_index;
reply.last_dirty_log_index = last_visible_index();
reply.last_flushed_log_index = _commit_index;
vlog(
_ctxlog.info,
Expand All @@ -1930,10 +1930,13 @@ consensus::do_append_entries(append_entries_request&& r) {
vlog(
_ctxlog.info,
"Truncating log in term: {}, Request previous log index: {} is "
"earlier than log end offset: {}. Truncating to: {}",
"earlier than log end offset: {}, last visible index: {}, leader "
"last visible index: {}. Truncating to: {}",
request_metadata.term,
request_metadata.prev_log_index,
lstats.dirty_offset,
last_visible_index(),
_last_leader_visible_offset,
truncate_at);
_probe->log_truncated();

Expand Down
Loading