lokeshj1703 commented on a change in pull request #378:
URL: https://github.com/apache/incubator-ratis/pull/378#discussion_r551758951
##########
File path:
ratis-server/src/main/java/org/apache/ratis/server/impl/RaftServerImpl.java
##########
@@ -1047,13 +1047,18 @@ private RequestVoteReplyProto requestVote(
synchronized (this) {
// Check life cycle state again to avoid the PAUSING/PAUSED state.
assertLifeCycleState(LifeCycle.States.RUNNING);
- final FollowerState fs = role.getFollowerState().orElse(null);
+ FollowerState fs = role.getFollowerState().orElse(null);
if (shouldWithholdVotes(candidateTerm)) {
LOG.info("{}-{}: Withhold vote from candidate {} with term {}. State:
leader={}, term={}, lastRpcElapsed={}",
getMemberId(), role, candidateId, candidateTerm,
state.getLeaderId(), state.getCurrentTerm(),
fs != null? fs.getLastRpcTime().elapsedTimeMs() + "ms": null);
} else if (state.recognizeCandidate(candidateId, candidateTerm)) {
final boolean termUpdated = changeToFollower(candidateTerm, true,
"recognizeCandidate:" + candidateId);
+ if (fs == null) {
Review comment:
I think we can remove the if condition here and call `fs =
role.getFollowerState().orElse(null);` always
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]