denis-chudov commented on code in PR #5552:
URL: https://github.com/apache/ignite-3/pull/5552#discussion_r2032951215


##########
modules/replicator/src/main/java/org/apache/ignite/internal/replicator/ReplicaStateManager.java:
##########
@@ -342,20 +342,27 @@ private CompletableFuture<Void> planDeferredReplicaStop(
         synchronized (context) {
             // TODO IGNITE-23702: proper sync with waiting of expiration 
event, and proper deferred stop after cancellation of
             //     reservation made by a lease that was not negotiated.
-            context.deferredStopReadyFuture = leaseExpirationTime == null
-                    ? new CompletableFuture<>()
-                    : clockService.waitFor(leaseExpirationTime);
+
+            // No parallel actions affected this, continue.
+            if (context.reservedForPrimary) {
+                context.deferredStopReadyFuture = leaseExpirationTime == null
+                        ? new CompletableFuture<>()
+                        : clockService.waitFor(leaseExpirationTime);
+            } else {
+                // context.unreserve() has been called in parallel, no need to 
wait.
+                context.deferredStopReadyFuture = 
CompletableFuture.completedFuture(null);

Review Comment:
   Minor: `nullCompletedFuture` may be here.



-- 
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: notifications-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to