Merged
Conversation
687a136 to
6326456
Compare
Signed-off-by: Daniele Sciascia <daniele@nats.io>
fa04062 to
5edec33
Compare
This commit fixes a bug where disjoint majorities could form during peer additions. Previously, node would update their cluster size only after the `EntryPeerAdd` log entry was committed by the cluster. This led to a situation where a leader could have a new peer in its peer set, before committing the corresponding EntryPeerAdd, while keeping the quorum size unchanged. This created the opportunity for a partitioned leader to commit EntryPeerAdd using only append entry responses from newly added nodes. For instance, a partitioned leader in a three node cluster, could form a majority with a newly added peer. Resulting in a 4 node membership, now requiring a quorum of 3. A subsequent peer addition would also succeed, using with the help of the two newly added nodes. Resulting in a 5 node membership with 3 functioning nodes on one side of the partition, and the old followers forming a different majority on the other side of the partition. The fix ensures that a node adds a new peer and adjusts its quorum calculation at the same time, right after appending the corresponding EntryAddPeer to its WAL. This is in line with the membership change algorithm given by Raft's original author (section 4.1 of Ongaro's thesis). With the revised logic, a partitioned leader of a 3 node cluster is unable to form a majority using the acknowledgement from the to be added peer. As the quorum now requires at least one acknowledgement coming from the original followers. Signed-off-by: Daniele Sciascia <daniele@nats.io>
Signed-off-by: Daniele Sciascia <daniele@nats.io>
5edec33 to
be7e595
Compare
neilalexander
added a commit
that referenced
this pull request
Dec 11, 2025
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.
This PR makes the following changes:
Signed-off-by: Daniele Sciascia daniele@nats.io