[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 Mar 20, 2026
Conversation
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)
scenario and bug described in https://docs.google.com/document/d/16GOxClpx_BHPh6Eg7WsLoOwStJhkS0o2jkIRb8hKvs0/edit?tab=t.0#heading=h.6bs87ao57qdi (cherry picked from commit e32d384)
6d2fc54 to
f58d10e
Compare
mmaslankaprv
approved these changes
Mar 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport of #29849
Backports Required
Release Notes
Bug Fixes