-
Notifications
You must be signed in to change notification settings - Fork 42
Members should not respond with Vote if sender is not in Configuration #49
Comments
After reading the code more closely, it looks like ChangeConfiguration messages are supposed to be the way that joint consensus is triggered. The behavior described in the javadoc comment matches the Raft spec:
However, it appears that the doc does not match with how the code actually behaves; nodes appear to apply the config as soon as they receive them, which can lead to violations of safety conditions. |
I have a replayable execution that tickles this behavior, in case that's of any use. |
Hi @colin-scott, yes a reproducer would be very welcome! Please post the reproducer (can be a gist, in line here, or a repo - whichever works best for you). |
Sounds good, I'll set up the reproducing scenario soon. |
A related issue: Suppose we send a ChangeConfiguration(raft-member-1, raft-member-2) message to 4 different nodes: raft-member-1, raft-member-2, raft-member-3, raft-member-4. This is admittedly a little strange, since raft-member-3 and 4 are not themselves included in the ChangeConfiguration message we send them. Regardless, the current behavior is the following: raft-member-3 and raft-member-4 might both start an election, so they send votes (only) to raft-member-1 and 2. raft-member-1 and raft-member-2 both respond with Votes! So it's possible that raft-member-3 and raft-member-4 will both become elected, and they can then override entries in raft-member-1 and 2. To replay this test case:
Console output here. Messages delivered in the test case (labels of the nodes are mixed around somewhat, since I started out with a 9-node cluster and minimized the execution to a 4 node cluster):
At the end of these message deliveries, raft-member-2 and raft-member-4 are both elected as leader in the same term. |
Suppose there are 5 nodes, labeled raft-member-{1-5}.
In the beginning, we send ChangeConfiguration(raft-member-1, raft-member-2, raft-member-3) [bootstrap] messages to raft-member-{1-3}.
Later, we add two nodes raft-member-{4-5}. We send new ChangeConfiguration(raft-member-1, raft-member-2, raft-member-3, raft-member-4, raft-member-5) messages to all 5 members, except, the messages arrive to raft-member-{4-5} much more quickly than they arrive to raft-member-{1-3}.
The current behavior in this scenario is that raft-member-4 or raft-member-5 will start an election, and send RequestVote messages to all members. Strangely, raft-member-{1-3} respond with votes (even though they are not aware of the existence of raft-member-{4-5})! This seems broken, as it can cause multiple leaders to be elected for the same term.
I realize this is probably not the proper way to initiate joint consensus, so maybe the fix is just to document the proper way to do so? Incidentally, how is joint consensus supposed to be triggered?
Thanks!
The text was updated successfully, but these errors were encountered: