Skip to content

Conversation

@cjen1-msft
Copy link
Contributor

While double checking the backport of the pre-vote I noticed that when separating the PreVote and Vote structs I had missed that the logging would still be using the original r.msg type and so print the wrong message type.

Additionally I noticed that I had the conditions with regards to when it is expected that you could get a delayed message inverted.
So receiving a RequestVoteResponse for a term while a PreVoteCandidate in that same term is instead possible, as a transition from Candidate to PreVoteCandidate via a lost election and then timing out is possible, but unlikely.
And it is receiving a RequestPreVoteResponse from a term while a Candidate for that same term should be impossible (see comment).

@cjen1-msft cjen1-msft marked this pull request as ready for review November 13, 2025 10:36
@cjen1-msft cjen1-msft requested a review from a team as a code owner November 13, 2025 10:36
Copilot AI review requested due to automatic review settings November 13, 2025 10:36
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes two issues related to pre-vote message handling in the Raft consensus implementation:

  • Corrects logging by ensuring the msg field is properly set when converting between PreVote and Vote message types
  • Fixes inverted logic for detecting delayed/stale vote response messages based on leadership state transitions
  • Updates the TLA specification to handle pre-vote response events

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
tla/consensus/Traceccfraft.tla Added recv_request_pre_vote_response event to the vote response handling condition
src/consensus/aft/raft.h Fixed msg field assignments in vote message conversions and corrected the conditions for detecting delayed vote responses with updated explanatory comments

Co-authored-by: Amaury Chamayou <amaury@xargs.fr>
@eddyashton eddyashton merged commit 4d55e14 into microsoft:main Nov 13, 2025
23 checks passed
@cjen1-msft cjen1-msft deleted the snag-prevote-logging branch November 14, 2025 09:27
cjen1-msft added a commit to cjen1-msft/CCF that referenced this pull request Nov 14, 2025
Co-authored-by: Amaury Chamayou <amaury@xargs.fr>
Co-authored-by: Amaury Chamayou <amchamay@microsoft.com>
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