You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@slider.apache.org by sm...@apache.org on 2014/10/25 02:47:37 UTC

git commit: SLIDER-564. Ensure default ZK node is always created and do not warn during delete if it does not exist

Repository: incubator-slider
Updated Branches:
  refs/heads/develop 9f31c5be5 -> 39a524455


SLIDER-564. Ensure default ZK node is always created and do not warn during delete if it does not exist


Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/39a52445
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/39a52445
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/39a52445

Branch: refs/heads/develop
Commit: 39a524455ea1b777f004e0efa826ef2c1521287a
Parents: 9f31c5b
Author: Sumit Mohanty <sm...@hortonworks.com>
Authored: Fri Oct 24 17:47:30 2014 -0700
Committer: Sumit Mohanty <sm...@hortonworks.com>
Committed: Fri Oct 24 17:47:30 2014 -0700

----------------------------------------------------------------------
 .../org/apache/slider/client/SliderClient.java  | 47 ++++++++------------
 1 file changed, 18 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/39a52445/slider-core/src/main/java/org/apache/slider/client/SliderClient.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/client/SliderClient.java b/slider-core/src/main/java/org/apache/slider/client/SliderClient.java
index 65eaaff..0a985ed 100644
--- a/slider-core/src/main/java/org/apache/slider/client/SliderClient.java
+++ b/slider-core/src/main/java/org/apache/slider/client/SliderClient.java
@@ -440,7 +440,6 @@ public class SliderClient extends AbstractSliderLaunchedService implements RunSe
    * Delete the zookeeper node associated with the calling user and the cluster
    * TODO: YARN registry operations
    **/
-  @Deprecated
   @VisibleForTesting
   public boolean deleteZookeeperNode(String clusterName) throws YarnException, IOException {
     String user = getUsername();
@@ -448,17 +447,13 @@ public class SliderClient extends AbstractSliderLaunchedService implements RunSe
     Exception e = null;
     try {
       Configuration config = getConfig();
-      if (!SliderUtils.isHadoopClusterSecure(config)) {
-        ZKIntegration client = getZkClient(clusterName, user);
-        if (client != null) {
-          if (client.exists(zkPath)) {
-            log.info("Deleting zookeeper path {}", zkPath);
-          }
-          client.deleteRecursive(zkPath);
-          return true;
+      ZKIntegration client = getZkClient(clusterName, user);
+      if (client != null) {
+        if (client.exists(zkPath)) {
+          log.info("Deleting zookeeper path {}", zkPath);
         }
-      } else {
-        log.warn("Default zookeeper node is not available for secure cluster");
+        client.deleteRecursive(zkPath);
+        return true;
       }
     } catch (InterruptedException ignored) {
       e = ignored;
@@ -468,7 +463,7 @@ public class SliderClient extends AbstractSliderLaunchedService implements RunSe
       e = ignored;
     }
     if (e != null) {
-      log.warn("Unable to recursively delete zk node {}", zkPath);
+      log.debug("Unable to recursively delete zk node {}", zkPath);
       log.debug("Reason: ", e);
     }
 
@@ -479,29 +474,23 @@ public class SliderClient extends AbstractSliderLaunchedService implements RunSe
    * Create the zookeeper node associated with the calling user and the cluster
    */
   @VisibleForTesting
-  @Deprecated
   public String createZookeeperNode(String clusterName, Boolean nameOnly) throws YarnException, IOException {
     String user = getUsername();
     String zkPath = ZKIntegration.mkClusterPath(user, clusterName);
-    if(nameOnly) {
+    if (nameOnly) {
       return zkPath;
     }
     Configuration config = getConfig();
-    if (!SliderUtils.isHadoopClusterSecure(config)) {
-      ZKIntegration client = getZkClient(clusterName, user);
-      if (client != null) {
-        try {
-          client.createPath(zkPath, "", ZooDefs.Ids.OPEN_ACL_UNSAFE,
-                            CreateMode.PERSISTENT);
-          return zkPath;
-          
-          //JDK7
-//        } catch (InterruptedException | KeeperException e) {
-        } catch (InterruptedException e) {
-          log.warn("Unable to create zk node {}", zkPath, e);
-        } catch ( KeeperException e) {
-          log.warn("Unable to create zk node {}", zkPath, e);
-        }
+    ZKIntegration client = getZkClient(clusterName, user);
+    if (client != null) {
+      try {
+        client.createPath(zkPath, "", ZooDefs.Ids.OPEN_ACL_UNSAFE,
+                          CreateMode.PERSISTENT);
+        return zkPath;
+      } catch (InterruptedException e) {
+        log.warn("Unable to create default zk node {}", zkPath, e);
+      } catch (KeeperException e) {
+        log.warn("Unable to create default zk node {}", zkPath, e);
       }
     }