From 99bced167bfed56efdd3c78537769ee89756d33d Mon Sep 17 00:00:00 2001 From: Karthik Kambatla Date: Wed, 2 Jul 2014 20:36:09 +0000 Subject: [PATCH] YARN-2241. ZKRMStateStore: On startup, show nicer messages if znodes already exist. (Robert Kanter via kasha) git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1607475 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-yarn-project/CHANGES.txt | 3 +++ .../recovery/ZKRMStateStore.java | 23 ++++++++++--------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index f223854b88f..d7607260645 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -193,6 +193,9 @@ Release 2.5.0 - UNRELEASED TestContainersMonitor#testContainerKillOnMemoryOverflow. (Anubhav Dhoot via kasha) + YARN-2241. ZKRMStateStore: On startup, show nicer messages if znodes already + exist. (Robert Kanter via kasha) + OPTIMIZATIONS BUG FIXES 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 01bca39ad07..6dd4574b42e 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 @@ -279,20 +279,21 @@ public class ZKRMStateStore extends RMStateStore { private void createRootDir(final String rootPath) throws Exception { // For root dirs, we shouldn't use the doMulti helper methods - try { - new ZKAction() { - @Override - public String run() throws KeeperException, InterruptedException { + new ZKAction() { + @Override + public String run() throws KeeperException, InterruptedException { + try { return zkClient.create(rootPath, null, zkAcl, CreateMode.PERSISTENT); + } catch (KeeperException ke) { + if (ke.code() == Code.NODEEXISTS) { + LOG.debug(rootPath + "znode already exists!"); + return null; + } else { + throw ke; + } } - }.runWithRetries(); - } catch (KeeperException ke) { - if (ke.code() == Code.NODEEXISTS) { - LOG.debug(rootPath + "znode already exists!"); - } else { - throw ke; } - } + }.runWithRetries(); } private void logRootNodeAcls(String prefix) throws Exception {