From f083f7fef14e2b0075cea92aae8fa79da75f3079 Mon Sep 17 00:00:00 2001 From: Jonathan Hung Date: Mon, 26 Aug 2019 15:45:13 -0700 Subject: [PATCH] YARN-9775. RMWebServices /scheduler-conf GET returns all hadoop configurations for ZKConfigurationStore. Contributed by Prabhu Joseph (cherry picked from commit 8660e48ca15098e891c560beb3181c22ef3f80ff) (cherry picked from commit e4249c320257586384035ea3fc286fe54cc699a1) (cherry picked from commit 6baa0d1e4d78c15833257d98bdd2b38806faed9f) --- .../scheduler/capacity/conf/ZKConfigurationStore.java | 2 +- .../scheduler/capacity/conf/TestZKConfigurationStore.java | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) 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/ZKConfigurationStore.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/ZKConfigurationStore.java index d9fd0e4a414..7c224a5813d 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/ZKConfigurationStore.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/ZKConfigurationStore.java @@ -196,7 +196,7 @@ public class ZKConfigurationStore extends YarnConfigurationStore { try { Map map = (HashMap) deserializeObject(serializedSchedConf); - Configuration c = new Configuration(); + Configuration c = new Configuration(false); for (Map.Entry e : map.entrySet()) { c.set(e.getKey(), e.getValue()); } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/conf/TestZKConfigurationStore.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/conf/TestZKConfigurationStore.java index 0e1a1e648e8..6e7cb545d30 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/conf/TestZKConfigurationStore.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/conf/TestZKConfigurationStore.java @@ -117,6 +117,8 @@ public class TestZKConfigurationStore extends ConfigurationStoreBaseTest { confStore.initialize(conf, schedConf, rmContext); assertEquals("val", confStore.retrieve().get("key")); + assertNull(confStore.retrieve().get(YarnConfiguration.RM_HOSTNAME)); + // Create a new configuration store, and check for old configuration confStore = createConfStore(); schedConf.set("key", "badVal");