xintongsong commented on a change in pull request #11615: [FLINK-16605] Add max 
limitation to the total number of slots
URL: https://github.com/apache/flink/pull/11615#discussion_r407404631
 
 

 ##########
 File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/resourcemanager/slotmanager/SlotManagerImpl.java
 ##########
 @@ -807,16 +813,29 @@ 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()) {
+                       if 
(slot.getResourceProfile().isMatching(resourceProfile)) {
+                               return true;
+                       }
+               }
+
                return false;
        }
 
        private Optional<PendingTaskManagerSlot> 
allocateResource(ResourceProfile requestedSlotResourceProfile) {
+               if (getNumberPendingTaskManagerSlots() + 
getNumberRegisteredSlots() + numSlotsPerWorker > maxSlotNum) {
+                       LOG.warn("Could not allocate more slots since the 
number of slots {} already reach maximum {}.",
 
 Review comment:
   We should also mention how many slots trying to allocate.
   E.g., say `numSlotsPerWorker` is 3, you might see a log as following.
   > Could not allocate more slots since the number of slots 9 already reach 
maximum 10.
   
   This could be confusing because 9 is not reaching 10.

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


With regards,
Apache Git Services

Reply via email to