kaijchen commented on code in PR #845:
URL: https://github.com/apache/ratis/pull/845#discussion_r1139931807
##########
ratis-server/src/main/java/org/apache/ratis/server/impl/TransferLeadership.java:
##########
@@ -151,29 +150,29 @@ private String tryTransferLeadership(LeaderStateImpl
leaderState, Context contex
return "LogAppender for transferee " + transferee + " is null";
}
final FollowerInfo follower = appender.getFollower();
- final String error = leaderState.sendStartLeaderElection(follower,
context.getLeaderLastEntry());
- if (error == null) {
- LOG.info("{}: sent StartLeaderElection to transferee {} immediately as
it already has up-to-date log",
+ if (follower == null) {
+ return "Follower for LogAppender" + appender + " is null";
+ }
+ if (LeaderStateImpl.isFollowerUpToDate(follower,
context.getLeaderLastEntry())) {
+ LOG.info("{}: sending StartLeaderElection to transferee {} immediately
as it already has up-to-date log",
+ server.getMemberId(), transferee);
Review Comment:
OK, but tryTransferLeadership returns `null` doesn't mean we have sent
StartLeaderElection immediately:
https://github.com/apache/ratis/pull/845/files/b19cccebaf2316fa9d16de21b77b4439f8514d33..d5d6b612c2015ade11e642041c1bdab77728f09a
--
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]