tillrohrmann commented on a change in pull request #10090: [FLINK-14560]
[runtime] The value of taskmanager.memory.size in flink…
URL: https://github.com/apache/flink/pull/10090#discussion_r344171292
##########
File path:
flink-runtime/src/main/java/org/apache/flink/runtime/util/ConfigurationParserUtils.java
##########
@@ -43,24 +44,16 @@
*/
public static long getManagedMemorySize(Configuration configuration) {
long managedMemorySize;
- String managedMemorySizeDefaultVal =
TaskManagerOptions.MANAGED_MEMORY_SIZE.defaultValue();
- if
(!configuration.getString(TaskManagerOptions.MANAGED_MEMORY_SIZE).equals(managedMemorySizeDefaultVal))
{
- try {
- managedMemorySize = MemorySize.parse(
-
configuration.getString(TaskManagerOptions.MANAGED_MEMORY_SIZE),
MEGA_BYTES).getMebiBytes();
- } catch (IllegalArgumentException e) {
- throw new IllegalConfigurationException("Could
not read " + TaskManagerOptions.MANAGED_MEMORY_SIZE.key(), e);
- }
- } else {
- managedMemorySize =
Long.valueOf(managedMemorySizeDefaultVal);
+ try {
+ managedMemorySize = MemorySize.parse(
+
configuration.getString(TaskManagerOptions.MANAGED_MEMORY_SIZE),
MEGA_BYTES).getMebiBytes();
+ } catch (IllegalArgumentException e) {
+ throw new IllegalConfigurationException("Could not read
" + TaskManagerOptions.MANAGED_MEMORY_SIZE.key(), e);
}
-
- checkConfigParameter(configuration.getString(
-
TaskManagerOptions.MANAGED_MEMORY_SIZE).equals(TaskManagerOptions.MANAGED_MEMORY_SIZE.defaultValue())
|| managedMemorySize > 0,
+ checkConfigParameter( managedMemorySize > 0,
managedMemorySize,
TaskManagerOptions.MANAGED_MEMORY_SIZE.key(),
"MemoryManager needs at least one MB of memory. " +
"If you leave this config parameter empty, the
system automatically pick a fraction of the available memory.");
Review comment:
I think we also need to check whether the configuration contains
`MANAGED_MEMORY_SIZE` as we have just removed the default value from the
`ConfigOption`. Only if `MANAGED_MEMORY_SIZE` is defined we should parse the
memory size and check that it is larger than 0. If not, then we should simply
return `0`.
----------------------------------------------------------------
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