-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
raft: add a batch of interaction-driven conf change tests
Verifiy the behavior in various v1 and v2 conf change operations. This also includes various fixups, notably it adds protection against transitioning in and out of new configs when this is not permissible. There are more threads to pull, but those are left for future commits.
- Loading branch information
Showing
14 changed files
with
940 additions
and
59 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
# Regression test that verifies that learners can vote. This holds only in the | ||
# sense that if a learner is asked to vote, a candidate believes that they are a | ||
# voter based on its current config, which may be more recent than that of the | ||
# learner. If learners which are actually voters but don't know it yet don't | ||
# vote in that situation, the raft group may end up unavailable despite a quorum | ||
# of voters (as of the latest config) being available. | ||
# | ||
# See: | ||
# https://github.com/etcd-io/etcd/pull/10998 | ||
|
||
# Turn output off during boilerplate. | ||
log-level none | ||
---- | ||
ok | ||
|
||
add-nodes 3 voters=(1,2) learners=(3) index=2 | ||
---- | ||
ok | ||
|
||
campaign 1 | ||
---- | ||
ok | ||
|
||
stabilize | ||
---- | ||
ok (quiet) | ||
|
||
propose-conf-change 1 | ||
v3 | ||
---- | ||
ok | ||
|
||
stabilize 1 2 | ||
---- | ||
ok (quiet) | ||
|
||
log-level debug | ||
---- | ||
ok | ||
|
||
campaign 2 | ||
---- | ||
INFO 2 is starting a new election at term 1 | ||
INFO 2 became candidate at term 2 | ||
INFO 2 received MsgVoteResp from 2 at term 2 | ||
INFO 2 [logterm: 1, index: 4] sent MsgVote request to 1 at term 2 | ||
INFO 2 [logterm: 1, index: 4] sent MsgVote request to 3 at term 2 | ||
|
||
# n2 is now campaigning while n1 is down (does not respond). The latest config | ||
# has n1 as a voter, but n1 doesn't even have the corresponding conf change in | ||
# its log. Still, it casts a vote for n2 which can in turn become leader and | ||
# catches up n3. | ||
stabilize 2 3 | ||
---- | ||
> 2 handling Ready | ||
Ready MustSync=true: | ||
Lead:0 State:StateCandidate | ||
HardState Term:2 Vote:2 Commit:4 | ||
Messages: | ||
2->1 MsgVote Term:2 Log:1/4 | ||
2->3 MsgVote Term:2 Log:1/4 | ||
> 3 receiving messages | ||
1->3 MsgApp Term:1 Log:1/3 Commit:3 Entries:[1/4 EntryConfChangeV2 v3] | ||
1->3 MsgApp Term:1 Log:1/4 Commit:4 | ||
2->3 MsgVote Term:2 Log:1/4 | ||
INFO 3 [term: 1] received a MsgVote message with higher term from 2 [term: 2] | ||
INFO 3 became follower at term 2 | ||
INFO 3 [logterm: 1, index: 4, vote: 0] cast MsgVote for 2 [logterm: 1, index: 4] at term 2 | ||
> 3 handling Ready | ||
INFO 3 switched to configuration voters=(1 2 3) | ||
Ready MustSync=true: | ||
Lead:0 State:StateFollower | ||
HardState Term:2 Vote:2 Commit:4 | ||
Entries: | ||
1/4 EntryConfChangeV2 v3 | ||
CommittedEntries: | ||
1/4 EntryConfChangeV2 v3 | ||
Messages: | ||
3->1 MsgAppResp Term:1 Log:0/4 | ||
3->1 MsgAppResp Term:1 Log:0/4 | ||
3->2 MsgVoteResp Term:2 Log:0/0 | ||
> 2 receiving messages | ||
3->2 MsgVoteResp Term:2 Log:0/0 | ||
INFO 2 received MsgVoteResp from 3 at term 2 | ||
INFO 2 has received 2 MsgVoteResp votes and 0 vote rejections | ||
INFO 2 became leader at term 2 | ||
> 2 handling Ready | ||
Ready MustSync=true: | ||
Lead:2 State:StateLeader | ||
Entries: | ||
2/5 EntryNormal "" | ||
Messages: | ||
2->1 MsgApp Term:2 Log:1/4 Commit:4 Entries:[2/5 EntryNormal ""] | ||
2->3 MsgApp Term:2 Log:1/4 Commit:4 Entries:[2/5 EntryNormal ""] | ||
> 3 receiving messages | ||
2->3 MsgApp Term:2 Log:1/4 Commit:4 Entries:[2/5 EntryNormal ""] | ||
> 3 handling Ready | ||
Ready MustSync=true: | ||
Lead:2 State:StateFollower | ||
Entries: | ||
2/5 EntryNormal "" | ||
Messages: | ||
3->2 MsgAppResp Term:2 Log:0/5 | ||
> 2 receiving messages | ||
3->2 MsgAppResp Term:2 Log:0/5 | ||
> 2 handling Ready | ||
Ready MustSync=false: | ||
HardState Term:2 Vote:2 Commit:5 | ||
CommittedEntries: | ||
2/5 EntryNormal "" | ||
Messages: | ||
2->3 MsgApp Term:2 Log:2/5 Commit:5 | ||
> 3 receiving messages | ||
2->3 MsgApp Term:2 Log:2/5 Commit:5 | ||
> 3 handling Ready | ||
Ready MustSync=false: | ||
HardState Term:2 Vote:2 Commit:5 | ||
CommittedEntries: | ||
2/5 EntryNormal "" | ||
Messages: | ||
3->2 MsgAppResp Term:2 Log:0/5 | ||
> 2 receiving messages | ||
3->2 MsgAppResp Term:2 Log:0/5 |
Oops, something went wrong.