diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index 09ec41a25d..287205df0f 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -302,6 +302,9 @@ Release 2.8.0 - UNRELEASED YARN-3375. NodeHealthScriptRunner.shouldRun() check is performing 3 times for starting NodeHealthScriptRunner. (Devaraj K via wangda) + YARN-2725. Added test cases of retrying creating znode in ZKRMStateStore. + (Tsuyoshi Ozawa via jianhe) + Release 2.7.1 - UNRELEASED INCOMPATIBLE CHANGES diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/ZKRMStateStore.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/ZKRMStateStore.java index 9da6400a42..97dd02990d 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/ZKRMStateStore.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/ZKRMStateStore.java @@ -297,7 +297,7 @@ public synchronized void startInternal() throws Exception { createRootDir(amrmTokenSecretManagerRoot); } - private void createRootDir(final String rootPath) throws Exception { + protected void createRootDir(final String rootPath) throws Exception { // For root dirs, we shouldn't use the doMulti helper methods new ZKAction() { @Override diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/TestZKRMStateStore.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/TestZKRMStateStore.java index 6b09d3920e..c632a061e3 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/TestZKRMStateStore.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/TestZKRMStateStore.java @@ -100,6 +100,15 @@ public String getAppNode(String appId) { return workingZnode + "/" + ROOT_ZNODE_NAME + "/" + RM_APP_ROOT + "/" + appId; } + + /** + * Emulating retrying createRootDir not to raise NodeExist exception + * @throws Exception + */ + public void testRetryingCreateRootDir() throws Exception { + createRootDir(znodeWorkingPath); + } + } public RMStateStore getRMStateStore() throws Exception { @@ -148,6 +157,8 @@ public void testZKRMStateStoreRealZK() throws Exception { testDeleteStore(zkTester); testRemoveApplication(zkTester); testAMRMTokenSecretManagerStateStore(zkTester); + ((TestZKRMStateStoreTester.TestZKRMStateStoreInternal) + zkTester.getRMStateStore()).testRetryingCreateRootDir(); } @Test (timeout = 60000)