zentol commented on a change in pull request #14393:
URL: https://github.com/apache/flink/pull/14393#discussion_r544677826



##########
File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/resourcemanager/slotmanager/DeclarativeSlotManager.java
##########
@@ -505,17 +496,12 @@ private void allocateSlot(TaskManagerSlotInformation 
taskManagerSlot, JobID jobI
                        resourceManagerId,
                        taskManagerRequestTimeout);
 
-               requestFuture.whenComplete(
+               CompletableFuture<Void> slotAllocationResponseProcessingFuture 
= requestFuture.handleAsync(
                        (Acknowledge acknowledge, Throwable throwable) -> {
-                               if (acknowledge != null) {
-                                       completableFuture.complete(acknowledge);
-                               } else {
-                                       
completableFuture.completeExceptionally(throwable);
+                               if (!pendingSlotAllocations.contains(slotId)) {
+                                       LOG.debug("Ignoring slot allocation 
update from task executor {} for slot {} and job {}, because the allocation was 
already completed or cancelled.", instanceId, slotId, jobId);
+                                       return null;
                                }
-                       });
-
-               CompletableFuture<Void> slotAllocationResponseProcessingFuture 
= completableFuture.handleAsync(
-                       (Acknowledge acknowledge, Throwable throwable) -> {
                                if (acknowledge != null) {
                                        LOG.trace("Completed allocation of slot 
{} for job {}.", slotId, jobId);
                                        
slotTracker.notifyAllocationComplete(slotId, jobId);

Review comment:
       hmmmm.....no, it should no longer be possible for the future to be 
canceled.




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to