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



##########
File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/resourcemanager/StandaloneResourceManagerFactory.java
##########
@@ -74,4 +81,21 @@
                        standaloneClusterStartupPeriodTime,
                        AkkaUtils.getTimeoutAsTime(configuration));
        }
+
+       /**
+        * Get the configuration for standalone ResourceManager, overwrite 
invalid configs.
+        *
+        * @param configuration configuration object
+        * @return the configuration for standalone ResourceManager
+        */
+       private static Configuration 
getConfigurationForStandaloneResourceManager(Configuration configuration) {
+               final Configuration copiedConfig = new 
Configuration(configuration);
+               if 
(configuration.contains(ResourceManagerOptions.MAX_SLOT_NUM)) {
+                       // The max slot limit should not take effect for 
standalone cluster, we overwrite the configure in case user
+                       // sets this value by mistake.
+                       LOG.warn("The {} should not take effect for standalone 
cluster, If configured, it will be ignored.", 
ResourceManagerOptions.MAX_SLOT_NUM.key());
+                       
copiedConfig.removeConfig(ResourceManagerOptions.MAX_SLOT_NUM);

Review comment:
       Optional; You don't need to use `.contains()` because `removeConfig()` 
returns a boolean that is `true` if the config was changed.

##########
File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/resourcemanager/slotmanager/SlotManagerImpl.java
##########
@@ -646,14 +658,48 @@ private TaskManagerSlot 
createAndRegisterTaskManagerSlot(SlotID slotId, Resource
        @Nullable
        private PendingTaskManagerSlot 
findExactlyMatchingPendingTaskManagerSlot(ResourceProfile resourceProfile) {
                for (PendingTaskManagerSlot pendingTaskManagerSlot : 
pendingSlots.values()) {
-                       if 
(pendingTaskManagerSlot.getResourceProfile().equals(resourceProfile)) {
+                       if 
(pendingSlotExactlyMatchingResourceProfile(pendingTaskManagerSlot, 
resourceProfile)) {
                                return pendingTaskManagerSlot;
                        }
                }
 
                return null;
        }
 
+       private boolean 
pendingSlotExactlyMatchingResourceProfile(PendingTaskManagerSlot 
pendingTaskManagerSlot, ResourceProfile resourceProfile) {

Review comment:
       
   ```suggestion
        private boolean 
isPendingSlotExactlyMatchingResourceProfile(PendingTaskManagerSlot 
pendingTaskManagerSlot, ResourceProfile resourceProfile) {
   ```




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


Reply via email to