Repository navigation
Conversation
A linearizable read paid a ReadIndex quorum round even when the leader had just proven a majority was answering it. The check-quorum window answers the same question: a majority acknowledged this leader at last_quorum_contact, and any successor needs a majority too, so no other node can have moved the log past the commit index before an election timeout elapses. leader_lease_index exposes that window; confirm_read_index serves locally inside it and falls back to the probe otherwise. Both instants are monotonic local time, and the window closes at the same threshold quorum_contact_lost demotes at, so a lease-answered read never outlives leader state.
Member
|
Closing: the lease reuses the step-down threshold as a read-safety bound, and that is unsafe.
A correct lease is measured from the heartbeat send time and bounded by |
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.
Why
A linearizable read paid a ReadIndex quorum round even when the leader had just proven a majority was answering it. The check-quorum window answers the same question: a majority acknowledged this leader at
last_quorum_contact, and any successor needs a majority too, so no other node can have moved the log past the commit index before an election timeout elapses.Part of #165 (P2 — cluster consensus safety).
What
RaftNode::leader_lease_index(now)(nodedb-raft/src/node/quorum_contact.rs): the commit index while the node is Leader andnow − last_quorum_contact < election_timeout_max. Both instants are this node's monotonic clock, so no skew bound applies; the window closes at the same thresholdquorum_contact_lostdemotes at, so a lease-answered read never outlives leader state.MultiRaft::leader_lease_index(group_id)mirrors the existing per-group accessors.confirm_read_index(read_index_wait.rs) serves locally when the lease is live and falls back to the probe otherwise. Refusal semantics unchanged (NotLeader/Timeoutpaths).Validation
cargo test -p nodedb-raft --lib quorum_contact— 13 passed (lease live after election; lapses at the step-down threshold; no lease off the leader path).cargo test -p nodedb-cluster --lib read_index— 4 passed.cargo check -p nodedb-cluster --all-targets— clean; repository preflight passes.Notes
MultiRaftReadGate::confirm_leader(the pgwire pre-dispatch read barrier).MultiRaftneeds heavy setup; the raft-level unit is the evidence.