-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Raft Cluster: Implement stale leader step-down after quorum loss #3916
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
87d649e
Implement stale leader step-down after quorum loss
bandalgomsu b305dca
Refactor use clusterRaftQuorum() consistently
bandalgomsu 3690db2
Refactor use RAFT_STATE() in step-down helpers
bandalgomsu 047bb2c
Docs clarify step-down helper comments
bandalgomsu 23f96ba
Refactor move quorum freshness checks to cron
bandalgomsu 4002e83
Refactor keep quorum-loss state leader-only
bandalgomsu d4b0da7
Refactor skip failure detection during quorum loss
bandalgomsu 0161b54
Fix Formatting
bandalgomsu 655516f
Docs modify comment in `clusterRaftStepDown`
bandalgomsu 4a843c2
Test move cluster_raft step-down test to a non-proto suite
bandalgomsu cb08ba7
Fix step down after one quorum-loss timeout
bandalgomsu 2e5e479
Test bound cluster_raft quorum-loss step-down timing
bandalgomsu b644e27
Test Simplify `cluster-raft.tcl`
bandalgomsu 3dfd390
Refactor Simplify `clusterRaftStepDown`
bandalgomsu 513cc3a
Merge remote-tracking branch 'upstream/cluster-v2' into issue-3861
bandalgomsu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| # Test higher-level Raft cluster behavior that does not require direct | ||
| # wire-protocol interaction from Tcl. | ||
|
|
||
| tags {external:skip cluster singledb} { | ||
|
|
||
| test "Raft: leader steps down after losing quorum freshness" { | ||
| start_multiple_servers 3 {overrides {cluster-enabled yes cluster-protocol raft cluster-node-timeout 1000}} { | ||
| [srv 0 client] CLUSTER MEET [srv -1 host] [srv -1 port] | ||
| [srv 0 client] CLUSTER MEET [srv -2 host] [srv -2 port] | ||
|
|
||
| wait_for_condition 50 100 { | ||
| [CI 0 cluster_size] == 3 && | ||
| [CI 1 cluster_size] == 3 && | ||
| [CI 2 cluster_size] == 3 | ||
| } else { | ||
| fail "Cluster did not form: sizes=[CI 0 cluster_size],[CI 1 cluster_size],[CI 2 cluster_size]" | ||
| } | ||
|
|
||
| assert_equal [CI 0 cluster_raft_role] "leader" | ||
| set leader_idx 0 | ||
|
|
||
| set paused [list] | ||
| foreach idx {0 1 2} { | ||
| if {$idx == $leader_idx} continue | ||
| pause_process [srv [expr {-$idx}] pid] | ||
| lappend paused $idx | ||
| } | ||
|
|
||
| wait_for_condition 100 50 { | ||
| [CI $leader_idx cluster_raft_role] eq "follower" | ||
| } else { | ||
| foreach idx $paused { | ||
| resume_process [srv [expr {-$idx}] pid] | ||
| } | ||
| fail "Leader did not step down after losing quorum freshness: role=[CI $leader_idx cluster_raft_role] leader=[CI $leader_idx cluster_raft_leader]" | ||
| } | ||
|
|
||
| foreach idx $paused { | ||
| resume_process [srv [expr {-$idx}] pid] | ||
| } | ||
| } | ||
| } | ||
|
|
||
| } ;# tags |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.