From 31591bb29671dca80e73a3e45855b969b746c5a0 Mon Sep 17 00:00:00 2001 From: Abhishek Modi Date: Sun, 1 Sep 2019 13:33:09 +0530 Subject: [PATCH] YARN-9791. Queue Mutation API does not allow to remove a config. Contributed by Prabhu Joseph. (cherry picked from commit 751b5a1ac871734c46cb934d100a5367f1dbf791) --- .../capacity/conf/MutableCSConfigurationProvider.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/conf/MutableCSConfigurationProvider.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/conf/MutableCSConfigurationProvider.java index 3e66439a1c3..c8d0a0c6eaa 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/conf/MutableCSConfigurationProvider.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/conf/MutableCSConfigurationProvider.java @@ -337,12 +337,14 @@ public class MutableCSConfigurationProvider implements CSConfigurationProvider, String keyPrefix = CapacitySchedulerConfiguration.PREFIX + queuePath + CapacitySchedulerConfiguration.DOT; for (Map.Entry kv : updateInfo.getParams().entrySet()) { - if (kv.getValue() == null) { + String keyValue = kv.getValue(); + if (keyValue == null || keyValue.isEmpty()) { + keyValue = null; proposedConf.unset(keyPrefix + kv.getKey()); } else { - proposedConf.set(keyPrefix + kv.getKey(), kv.getValue()); + proposedConf.set(keyPrefix + kv.getKey(), keyValue); } - confUpdate.put(keyPrefix + kv.getKey(), kv.getValue()); + confUpdate.put(keyPrefix + kv.getKey(), keyValue); } } }