KarmaGYZ commented on a change in pull request #14897: URL: https://github.com/apache/flink/pull/14897#discussion_r578874000
########## File path: flink-runtime/src/main/java/org/apache/flink/runtime/resourcemanager/slotmanager/BiDirectionalResourceToRequirementMapping.java ########## @@ -74,23 +81,26 @@ private static void internalDecrementCount( "Attempting to decrement count of %s->%s, but primary key was unknown.", resourceProfile, secondaryKey); - resourceCounter.decrementCount(secondaryKey, decrement); - return resourceCounter.isEmpty() ? null : resourceCounter; + final ResourceCounter newCounter = + resourceCounter.subtract(secondaryKey, decrement); + return newCounter.isEmpty() ? null : newCounter; }); } - public Map<ResourceProfile, Integer> getResourcesFulfilling(ResourceProfile requirement) { + public Collection<Map.Entry<ResourceProfile, Integer>> getResourcesFulfilling( Review comment: Yes, I think we can directly return the `ResourceCounter` since it is immutable now. ---------------------------------------------------------------- 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