Skip to content

Reserve logs before truncation boundary - #931

Merged
xiaoxichen merged 1 commit into
eBay:stable/v7.xfrom
Besroy:fix_trunc
Sep 30, 2026
Merged

xiaoxichen merged 1 commit into
eBay:stable/v7.xfrom
Besroy:fix_trunc

Conversation

@Besroy

@Besroy Besroy commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

This change fixes a false-negative snapshot case where the leader can truncate up to a lagging peer's replication index, making the local log start at replication_idx + 1. NuRaft still treats append from that start index as log-range-valid, but it needs prevLogTerm for replication_idx and term_for_log() fails because that entry has already been truncated.

Keep a configurable number of logs before the minimum peer replication index so the leader can either append with a valid prevLogIdx term or correctly fall back to snapshot when the peer is farther behind.

@Besroy
Besroy requested a review from xiaoxichen September 30, 2026 07:48
Comment thread src/lib/replication/repl_dev/raft_repl_dev.cpp Outdated

@xiaoxichen xiaoxichen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm in general except some nit

This change fixes a false-negative snapshot case where the leader can truncate up to a lagging peer's replication index, making the local log start at replication_idx + 1. NuRaft still treats append from that start index as log-range-valid, but it needs prevLogTerm for replication_idx and term_for_log() fails because that entry has already been truncated.

Keep a configurable number of logs before the minimum peer replication index so the leader can either append with a valid prevLogIdx term or correctly fall back to snapshot when the peer is farther behind.
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 60.00000% with 2 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (stable/v7.x@5921dcd). Learn more about missing BASE report.

Files with missing lines Patch % Lines
src/lib/replication/repl_dev/raft_repl_dev.cpp 60.00% 0 Missing and 2 partials ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@              Coverage Diff               @@
##             stable/v7.x     #931   +/-   ##
==============================================
  Coverage               ?   48.27%           
==============================================
  Files                  ?      110           
  Lines                  ?    13122           
  Branches               ?     6330           
==============================================
  Hits                   ?     6335           
  Misses                 ?     2557           
  Partials               ?     4230           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@xiaoxichen
xiaoxichen merged commit 0d224a5 into eBay:stable/v7.x Sep 30, 2026
39 of 41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants