kaijchen commented on code in PR #845:
URL: https://github.com/apache/ratis/pull/845#discussion_r1139934406


##########
ratis-server/src/main/java/org/apache/ratis/server/impl/TransferLeadership.java:
##########
@@ -134,12 +134,11 @@ boolean isSteppingDown() {
   void onFollowerAppendEntriesReply(LeaderStateImpl leaderState, FollowerInfo 
follower) {
     // If the transferee has just append some entries and becomes up-to-date,
     // send StartLeaderElection to it
-    if (getTransferee().filter(t -> t.equals(follower.getId())).isPresent()) {
-      final String error = leaderState.sendStartLeaderElection(follower, 
leaderState.getLastEntry());
-      if (error == null) {
-        LOG.info("{}: sent StartLeaderElection to transferee {} after received 
AppendEntriesResponse",
-            server.getMemberId(), follower.getId());
-      }
+    if (getTransferee().filter(t -> t.equals(follower.getId())).isPresent()
+        && LeaderStateImpl.isFollowerUpToDate(follower, 
leaderState.getLastEntry())) {
+      LOG.info("{}: sending StartLeaderElection to transferee {} after 
received AppendEntriesResponse",
+          server.getMemberId(), follower.getId());
+      leaderState.sendStartLeaderElection(follower.getId(), 
leaderState.getLastEntry());

Review Comment:
   Updated.



-- 
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]

Reply via email to