Github user tillrohrmann commented on a diff in the pull request:

    https://github.com/apache/flink/pull/4887#discussion_r148551966
  
    --- Diff: 
flink-runtime/src/main/java/org/apache/flink/runtime/resourcemanager/slotmanager/SlotManager.java
 ---
    @@ -302,7 +302,12 @@ public boolean unregisterSlotRequest(AllocationID 
allocationId) {
                PendingSlotRequest pendingSlotRequest = 
pendingSlotRequests.remove(allocationId);
     
                if (null != pendingSlotRequest) {
    -                   cancelPendingSlotRequest(pendingSlotRequest);
    +                   if (pendingSlotRequest.isAssigned()) {
    +                           cancelPendingSlotRequest(pendingSlotRequest);
    +                   }
    +                   else {
    +                           
resourceActions.cancelResourceAllocation(pendingSlotRequest.getResourceProfile());
    --- End diff --
    
    I think we should not immediately cancel ongoing resource allocations. The 
`SlotManager` could decide upon registration of a new worker whether this one 
is actually needed or not. In the latter case it could release the resource. 
This would also simplify the protocol since you don't know whether you still 
can cancel an ongoing resource allocation.


---

Reply via email to