-
Notifications
You must be signed in to change notification settings - Fork 652
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
Make manual failover reset the on-going election to promote failover #1274
base: unstable
Are you sure you want to change the base?
Changes from all commits
db379e1
0595cd0
de98db8
6c37c58
97487bf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -183,3 +183,45 @@ test "Wait for instance #0 to return back alive" { | |
} | ||
|
||
} ;# start_cluster | ||
|
||
start_cluster 3 1 {tags {external:skip cluster} overrides {cluster-ping-interval 1000 cluster-node-timeout 15000}} { | ||
test "Manual failover will reset the on-going election" { | ||
set CLUSTER_PACKET_TYPE_FAILOVER_AUTH_REQUEST 5 | ||
set CLUSTER_PACKET_TYPE_NONE -1 | ||
|
||
# Let other primaries drop FAILOVER_AUTH_REQUEST so that the election won't | ||
# get the enough votes and the election will time out. | ||
R 1 debug drop-cluster-packet-filter $CLUSTER_PACKET_TYPE_FAILOVER_AUTH_REQUEST | ||
R 2 debug drop-cluster-packet-filter $CLUSTER_PACKET_TYPE_FAILOVER_AUTH_REQUEST | ||
|
||
# Replica doing the manual failover. | ||
R 3 cluster failover | ||
|
||
# Waiting for primary and replica to confirm manual failover timeout. | ||
wait_for_log_messages 0 {"*Manual failover timed out*"} 0 1000 50 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i forgot to mention in here, the wait will take at least 5 seconds since the manual failover timeout is 5s, i can use other fields maybe like epoch to replace it if needed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using log messages should be OK. |
||
wait_for_log_messages -3 {"*Manual failover timed out*"} 0 1000 50 | ||
set loglines1 [count_log_lines 0] | ||
set loglines2 [count_log_lines -3] | ||
|
||
# Undo packet drop, so that replica can win the next election. | ||
R 1 debug drop-cluster-packet-filter $CLUSTER_PACKET_TYPE_NONE | ||
R 2 debug drop-cluster-packet-filter $CLUSTER_PACKET_TYPE_NONE | ||
Comment on lines
+207
to
+208
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I really like the usage of these constants, we should probably do it more to improve readability in tests. |
||
|
||
# Replica doing the manual failover again. | ||
R 3 cluster failover | ||
|
||
# Make sure the election is reset. | ||
wait_for_log_messages -3 {"*Failover election in progress*Resetting the election*"} $loglines2 1000 50 | ||
|
||
# Wait for failover. | ||
wait_for_condition 1000 50 { | ||
[s -3 role] == "master" | ||
} else { | ||
fail "No failover detected" | ||
} | ||
|
||
# Make sure that the second manual failover does not time out. | ||
verify_no_log_message 0 "*Manual failover timed out*" $loglines1 | ||
verify_no_log_message -3 "*Manual failover timed out*" $loglines2 | ||
} | ||
} ;# start_cluster |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we rather invoke
resetManualFailover
and clean upfailover_auth_time
in that period?We should anyway cleanup failover_auth_time in the resetManualFailover method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have thought about putting it in resetManualFailover, but I was worried about introducing other problems since resetManualFailover is called in many places.