kaijchen commented on code in PR #807:
URL: https://github.com/apache/ratis/pull/807#discussion_r1093251388
##########
ratis-server/src/main/java/org/apache/ratis/server/impl/TransferLeadership.java:
##########
@@ -81,11 +83,47 @@ public String toString() {
this.server = server;
}
+ private RaftPeerId getTransferee() {
+ return Optional.ofNullable(pending.get())
+ .map(r -> r.getRequest().getNewLeader()).orElse(null);
+ }
+
boolean isSteppingDown() {
return pending.get() != null;
}
- CompletableFuture<RaftClientReply> start(TransferLeadershipRequest request) {
+ void onFollowerAppendEntriesReply(LeaderStateImpl leaderState, FollowerInfo
follower) {
+ final RaftPeerId transferee = getTransferee();
+ // If TransferLeadership is in progress, and the transferee has just
append some entries
+ if (follower.getPeer().getId().equals(transferee)) {
Review Comment:
Good catch. And I forgot to change `follower.getPeer().getId()` to
`follower.getId()`.
--
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]