szetszwo commented on code in PR #811:
URL: https://github.com/apache/ratis/pull/811#discussion_r1080961037
##########
ratis-server/src/main/java/org/apache/ratis/server/impl/LeaderStateImpl.java:
##########
@@ -685,6 +687,22 @@ private synchronized void
sendStartLeaderElectionToHigherPriorityPeer(RaftPeerId
});
}
+ boolean sendStartLeaderElection(FollowerInfo followerInfo) {
+ final RaftPeerId followerId = followerInfo.getPeer().getId();
+ final TermIndex leaderLastEntry = server.getState().getLastEntry();
+ if (leaderLastEntry == null) {
+ sendStartLeaderElection(followerId, null);
+ return true;
+ }
+
+ final long followerMatchIndex = followerInfo.getMatchIndex();
+ if (followerMatchIndex >= leaderLastEntry.getIndex()) {
Review Comment:
We do not hold a lock so that the `matchIndex` could (theoretically) be
updated after `getLastEntry()`. I believe it won't happen in the current code
though.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]