helix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l...@apache.org
Subject [5/9] helix git commit: Refactor isClusterSetup log structure for debugging purpose
Date Thu, 02 Feb 2017 17:53:25 GMT
Refactor isClusterSetup log structure for debugging purpose


Project: http://git-wip-us.apache.org/repos/asf/helix/repo
Commit: http://git-wip-us.apache.org/repos/asf/helix/commit/5ee5e59b
Tree: http://git-wip-us.apache.org/repos/asf/helix/tree/5ee5e59b
Diff: http://git-wip-us.apache.org/repos/asf/helix/diff/5ee5e59b

Branch: refs/heads/helix-0.6.x
Commit: 5ee5e59ba2eb86019fbef69e10f02d7bd73eedd5
Parents: 9ebf3e9
Author: Junkai Xue <jxue@linkedin.com>
Authored: Sat Jan 28 17:38:41 2017 -0800
Committer: Junkai Xue <jxue@linkedin.com>
Committed: Wed Feb 1 20:19:43 2017 -0800

----------------------------------------------------------------------
 .../org/apache/helix/manager/zk/ZKUtil.java     | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/helix/blob/5ee5e59b/helix-core/src/main/java/org/apache/helix/manager/zk/ZKUtil.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/manager/zk/ZKUtil.java b/helix-core/src/main/java/org/apache/helix/manager/zk/ZKUtil.java
index 2e19484..2840dbb 100644
--- a/helix-core/src/main/java/org/apache/helix/manager/zk/ZKUtil.java
+++ b/helix-core/src/main/java/org/apache/helix/manager/zk/ZKUtil.java
@@ -42,7 +42,13 @@ public final class ZKUtil {
   }
 
   public static boolean isClusterSetup(String clusterName, ZkClient zkClient) {
-    if (clusterName == null || zkClient == null) {
+    if (clusterName == null) {
+      logger.info("Fail to check cluster setup : cluster name is null!");
+      return false;
+    }
+
+    if (zkClient == null) {
+      logger.info("Fail to check cluster setup : zookeeper client is null!");
       return false;
     }
     ArrayList<String> requiredPaths = new ArrayList<String>();
@@ -68,14 +74,20 @@ public final class ZKUtil {
 
     BaseDataAccessor<Object> baseAccessor = new ZkBaseDataAccessor<Object>(zkClient);
     boolean[] ret = baseAccessor.exists(requiredPaths, 0);
+    StringBuilder errorMsg = new StringBuilder();
+
     for (int i = 0; i < ret.length; i++) {
       if (!ret[i]) {
         isValid = false;
-        if (logger.isDebugEnabled()) {
-          logger.debug("Invalid cluster setup, missing znode path: " + requiredPaths.get(i));
-        }
+        errorMsg
+            .append(("Invalid cluster setup, missing znode path: " + requiredPaths.get(i))
+ "\n");
       }
     }
+
+    if (!isValid) {
+      logger.info(errorMsg.toString());
+    }
+
     return isValid;
   }
 


Mime
View raw message