浏览代码

YARN-11551. RM format-conf-store should delete all the content of ZKConfigStore (#5958)

Benjamin Teke 2 年之前
父节点
当前提交
ebc32fbcaf

+ 3 - 2
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

@@ -64,6 +64,7 @@ public class ZKConfigurationStore extends YarnConfigurationStore {
   private static final String CONF_VERSION_PATH = "CONF_VERSION";
   private static final String CONF_VERSION_PATH = "CONF_VERSION";
   private static final String NODEEXISTS_MSG = "Encountered NodeExists error."
   private static final String NODEEXISTS_MSG = "Encountered NodeExists error."
       + " Skipping znode creation since another RM has already created it";
       + " Skipping znode creation since another RM has already created it";
+  private String znodeParentPath;
   private String zkVersionPath;
   private String zkVersionPath;
   private String logsPath;
   private String logsPath;
   private String confStorePath;
   private String confStorePath;
@@ -78,7 +79,7 @@ public class ZKConfigurationStore extends YarnConfigurationStore {
       RMContext rmContext) throws Exception {
       RMContext rmContext) throws Exception {
     this.conf = config;
     this.conf = config;
 
 
-    String znodeParentPath = conf.get(
+    this.znodeParentPath = conf.get(
         YarnConfiguration.RM_SCHEDCONF_STORE_ZK_PARENT_PATH,
         YarnConfiguration.RM_SCHEDCONF_STORE_ZK_PARENT_PATH,
         YarnConfiguration.DEFAULT_RM_SCHEDCONF_STORE_ZK_PARENT_PATH);
         YarnConfiguration.DEFAULT_RM_SCHEDCONF_STORE_ZK_PARENT_PATH);
 
 
@@ -144,7 +145,7 @@ public class ZKConfigurationStore extends YarnConfigurationStore {
 
 
   @Override
   @Override
   public void format() throws Exception {
   public void format() throws Exception {
-    zkManager.delete(confStorePath);
+    zkManager.delete(znodeParentPath);
   }
   }
 
 
   @Override
   @Override