amaliujia commented on code in PR #1710:
URL: https://github.com/apache/ratis/pull/1710#discussion_r4704208439
##########
ratis-server/src/main/java/org/apache/ratis/server/impl/TransferLeadership.java:
##########
@@ -317,7 +317,9 @@ private CompletableFuture<RaftClientReply> start(Context
context) {
final Result result = tryTransferLeadership(context);
final Result.Type type = result.getType();
if (type != Result.Type.SUCCESS && type != Result.Type.NOT_UP_TO_DATE) {
- pendingRequest.complete(result);
+ if (pending.compareAndSet(pendingRequest, null)) {
+ pendingRequest.complete(result);
+ }
Review Comment:
Why don't we always complete the result if the result is already in the bad
cases
```
pending.compareAndSet(pendingRequest, null);
pendingRequest.complete(result);
```
--
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]