tillrohrmann commented on a change in pull request #7227: [FLINK-11059] 
[runtime] do not add releasing failed slot to free slots
URL: https://github.com/apache/flink/pull/7227#discussion_r292875886
 
 

 ##########
 File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/slotpool/SlotPoolImpl.java
 ##########
 @@ -715,6 +717,19 @@ public boolean releaseTaskManager(final ResourceID 
resourceId, final Exception c
                }
        }
 
+       @Override
+       public SlotSnapshot createSlotSnapshot(ResourceID taskManagerId) {
+               Set<AllocatedSlot> totalSlots = new HashSet<>();
+               
totalSlots.addAll(availableSlots.getSlotsForTaskManager(taskManagerId));
+               
totalSlots.addAll(allocatedSlots.getSlotsForTaskManager(taskManagerId));
 
 Review comment:
   No need to create the extra collection here:
   ```
   @Override
        public SlotSnapshot createSlotSnapshot(ResourceID taskManagerId) {
                final Set<AllocatedSlot> availabeSlotsForTaskManager = 
availableSlots.getSlotsForTaskManager(taskManagerId);
                final Set<AllocatedSlot> allocatedSlotsForTaskManager = 
allocatedSlots.getSlotsForTaskManager(taskManagerId);
   
                List<OfferedSlot> offeredSlots = new 
ArrayList<>(availabeSlotsForTaskManager.size() + 
allocatedSlotsForTaskManager.size());
                for (AllocatedSlot allocatedSlot : 
Iterables.concat(availabeSlotsForTaskManager, allocatedSlotsForTaskManager)) {
                        offeredSlots.add(new 
OfferedSlot(allocatedSlot.getPhysicalSlotNumber(), 
allocatedSlot.getAllocationId()));
                }
                return new SlotSnapshot(jobId, offeredSlots);
        }
   ```

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


With regards,
Apache Git Services

Reply via email to