-
Notifications
You must be signed in to change notification settings - Fork 406
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
RATIS-1112. Ensure a node doesn't get reelected as a leader if it vol… #252
Conversation
…untarily steps down.
ratis-server/src/test/java/org/apache/ratis/server/impl/LeaderElectionTests.java
Show resolved
Hide resolved
@@ -88,6 +93,20 @@ void stopRunning() { | |||
this.isRunning = false; | |||
} | |||
|
|||
boolean lostMajorityHeartbeats() { |
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.
how about rename to isTimeoutSinceLostMajorityHeartbeats
and return elapsed.compareTo(waitTime) >= 0
?
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 got that you wanted to invert the boolean. However, "isTimeoutSinceLostMajorityHeartbeats" is hard to understand. So, let's keep "lostMajorityHeartbeats"? Or I can change it to ""lostMajorityHeartbeatsRecently".
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.
Okay, lostMajorityHeartbeatsRecently
is better.
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.
Done.
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.
LGTM
…untarily steps down. (apache#252)
See https://issues.apache.org/jira/browse/RATIS-1112