Skip to content

[backport] [v25.3.x] raft: fix offset translator inconsistencies arising from incorrect truncation #29849#29872

Merged
bharathv merged 2 commits intoredpanda-data:v25.3.xfrom
bharathv:bp_ots_v25.3.x
Mar 20, 2026
Merged

[backport] [v25.3.x] raft: fix offset translator inconsistencies arising from incorrect truncation #29849#29872
bharathv merged 2 commits intoredpanda-data:v25.3.xfrom
bharathv:bp_ots_v25.3.x

Conversation

@bharathv
Copy link
Copy Markdown
Contributor

Backport of #29849

Backports Required

  • none - not a bug fix
  • none - this is a backport
  • none - issue does not exist in previous branches
  • none - papercut/not impactful enough to backport
  • v25.3.x
  • v25.2.x
  • v25.1.x

Release Notes

Bug Fixes

  • Fixes a possible cause of offset translator inconsistency arising from incorrect truncation of the log.

When append_entries triggers a truncation and has leftover batches, the
recursive do_append_entries call reuses the original (stale) prev_log_index.
With large ghost batches from compaction, this causes the matching loop
to place the incoming batches at incorrect offsets since they matched
relative to prev_log_index.

Instead of recursing, return success after truncation and let the
leader's recovery loop send remaining batches with correct metadata
from its own log.

We return success instead of recursing with a mutated append_entries
request because we do not want to risk corrupting the request with an
incorrect prev_log_delta based on the local log. We rather want to
populate it from the leader log, which is the source of truth and easier
to reason about. This may can an additional round trip but that is ok
since this is very very rare and also on a follower, so not in a typical
read/write path.

(cherry picked from commit 889bde3)
@bharathv bharathv merged commit 42a4418 into redpanda-data:v25.3.x Mar 20, 2026
18 checks passed
@bharathv bharathv deleted the bp_ots_v25.3.x branch March 20, 2026 01:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants