You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2020/01/03 11:43:35 UTC

[GitHub] [flink] tillrohrmann commented on a change in pull request #10716: [FLINK-15367][runtime] Handle backwards compatibility of "taskmanager.heap.size" differently for standalone / active setups

tillrohrmann commented on a change in pull request #10716: [FLINK-15367][runtime] Handle backwards compatibility of "taskmanager.heap.size" differently for standalone / active setups
URL: https://github.com/apache/flink/pull/10716#discussion_r362779008
 
 

 ##########
 File path: flink-runtime/src/main/java/org/apache/flink/runtime/clusterframework/TaskExecutorResourceUtils.java
 ##########
 @@ -688,4 +669,55 @@ public static Configuration adjustConfigurationForLocalExecution(final Configura
 
 		return modifiedConfig;
 	}
+
+	public static Configuration adjustConfigurationForStandaloneSetups(final Configuration configuration) {
+		return getConfigurationMapLegacyTaskManagerHeapSizeToConfigOption(
+			configuration, TaskManagerOptions.TOTAL_FLINK_MEMORY);
+	}
+
+	public static Configuration adjustConfigurationForContainerizedSetups(final Configuration configuration) {
+		return getConfigurationMapLegacyTaskManagerHeapSizeToConfigOption(
+			configuration, TaskManagerOptions.TOTAL_PROCESS_MEMORY);
+	}
+
+	private static Configuration getConfigurationMapLegacyTaskManagerHeapSizeToConfigOption(
+		final Configuration configuration, ConfigOption<MemorySize> configOption) {
+
+		final Optional<MemorySize> legacyHeapSizeOptional = getLegacyTaskManagerHeapMemoryIfExplicitlyConfigured(configuration);
+		if (legacyHeapSizeOptional.isPresent()) {
+			final Configuration copiedConfig = new Configuration(configuration);
+			copiedConfig.set(configOption, legacyHeapSizeOptional.get());
+			return copiedConfig;
+		}
+
+		return configuration;
+	}
 
 Review comment:
   What happens if `configOption` has been set? I think then new option should have precedence. We should also add tests for this scenario.

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


With regards,
Apache Git Services