Repository navigation
bft: restore in-flight proposal kept by a view record - #748
Merged
HagarMeir merged 1 commit intoNov 4, 2026
Merged
Conversation
HagarMeir
reviewed
Nov 3, 2026
HagarMeir
left a comment
Contributor
There was a problem hiding this comment.
Looks good to me. Two small requests, neither of them a blocker:
- The inline one below asks for an integration test.
- Could you link or open an issue for this? It's a separate bug from #736 (it's about what a restarted node reports in a view change, not WAL growth), and it'd be good to have it on record.
(Written by Claude Code.)
| // ViewChange record kept in the WAL because it was still needed for a view change. | ||
| // Only the in-flight data is restored: the view record defines the current view, so | ||
| // the view phase, number and sequence stay as they are. | ||
| func (ps *PersistedState) restoreInFlightBeforeViewRecord(v *View) error { |
Contributor
There was a problem hiding this comment.
Not a blocker: could this get an integration test too? A node that prepares, goes through a view change, restarts, and then sends ViewData that still reports the prepared proposal. The unit tests cover the WAL parsing, but not that the restored state reaches the ViewData.
(Written by Claude Code.)
A ViewChange or NewView record written with truncateTo=false keeps the preceding ProposedRecord/Commit in the WAL because the in-flight proposal is still needed. Restore only looked at the last entry: when it was NewView or ViewChange, Restore returned nil and left InFlightProposal empty. A restart then lost the proposal that the non-truncating record had preserved. Scan backwards from the trailing view record for the latest proposal pair and restore only InFlightData. The view record defines the current view, so the view phase, number and sequence stay unchanged. Signed-off-by: Fedor Partanskiy <fredprtnsk@gmail.com>
pfi79
force-pushed
the
restore-inflight-before-view-record
branch
from
November 3, 2026 13:40
fd76997 to
5f5d792
Compare
HagarMeir
approved these changes
Nov 4, 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.
A ViewChange or NewView record written with truncateTo=false keeps the preceding ProposedRecord/Commit in the WAL because the in-flight proposal is still needed. Restore only looked at the last entry: when it was NewView or ViewChange, Restore returned nil and left InFlightProposal empty. A restart then lost the proposal that the non-truncating record had preserved.
Scan backwards from the trailing view record for the latest proposal pair and restore only InFlightData. The view record defines the current view, so the view phase, number and sequence stay unchanged.
Fixes #749