Skip to content

Commit

Permalink
Merge pull request #16530 from mmaslankaprv/vbotbuildovich/backport-1…
Browse files Browse the repository at this point in the history
…6475-v23.2.x-880

[v23.2.x] Improved handling of truncation with ACKS=1
  • Loading branch information
piyushredpanda authored Feb 7, 2024
2 parents 775c7d8 + 1645940 commit d2f8252
Showing 1 changed file with 6 additions and 3 deletions.
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

0 comments on commit d2f8252

Please sign in to comment.