KarmaGYZ commented on a change in pull request #11615:
URL: https://github.com/apache/flink/pull/11615#discussion_r412623864



##########
File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/resourcemanager/slotmanager/SlotManagerImpl.java
##########
@@ -804,16 +850,31 @@ private void 
fulfillPendingSlotRequestWithPendingTaskManagerSlot(PendingSlotRequ
                return Optional.empty();
        }
 
-       private boolean isFulfillableByRegisteredSlots(ResourceProfile 
resourceProfile) {
+       private boolean isFulfillableByRegisteredOrPendingSlots(ResourceProfile 
resourceProfile) {
                for (TaskManagerSlot slot : slots.values()) {
                        if 
(slot.getResourceProfile().isMatching(resourceProfile)) {
                                return true;
                        }
                }
+
+               for (PendingTaskManagerSlot slot : pendingSlots.values()) {

Review comment:
       Before this change:
   - For Yarn/K8s mode, as long as the ResourceProfile of the `SlotRequest` 
could fit in the `defaultSlotResourceProfile`, the SlotManager would always 
trigger `allocateResource` and get `pendingSlot`. The "resource fit" check has 
already been done in `allocateResource` for Yarn/K8s. 
   - For Standalone mode, it will set `failUnfulfillableRequest` to false for a 
startup period to wait there is registered slot in the cluster. Since the 
`ResourceManager#allocateResource` would always return false in standalone 
mode, this method checks whether the ResourceProfile of the `SlotRequest` could 
fit in.
   
   After this change:
   - For Yarn/K8s mode, even if the ResourceProfile of the `SlotRequest` could 
fit in the `defaultSlotResourceProfile`, the `allocateResource` could return no 
`pendingSlot` when the total number of slot reaches max limit. In this case, 
the "resource fit in" check should be move to 
`isFulfillableByRegisteredOrPendingSlots` function. However, the `pendingSlot` 
might not register back at the startup period and the `slots` could be empty. 
So, we check `pendingSlot` there.
   - For Standalone mode, since there is no `pendingSlot`, we do not break the 
origin behavior.




----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to