You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@helix.apache.org by lx...@apache.org on 2017/02/02 17:53:23 UTC

[3/9] helix git commit: More specific log message when verification is in progress

More specific log message when verification is in progress


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

Branch: refs/heads/helix-0.6.x
Commit: e0f9f96c47693bcaaf01fc0c84a9177d8f5b9547
Parents: fb7496f
Author: Junkai Xue <jx...@linkedin.com>
Authored: Sat Jan 28 16:34:53 2017 -0800
Committer: Junkai Xue <jx...@linkedin.com>
Committed: Sat Jan 28 16:34:53 2017 -0800

----------------------------------------------------------------------
 .../apache/helix/tools/ClusterStateVerifier.java | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/helix/blob/e0f9f96c/helix-core/src/main/java/org/apache/helix/tools/ClusterStateVerifier.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/tools/ClusterStateVerifier.java b/helix-core/src/main/java/org/apache/helix/tools/ClusterStateVerifier.java
index b5b864c..a87740e 100644
--- a/helix-core/src/main/java/org/apache/helix/tools/ClusterStateVerifier.java
+++ b/helix-core/src/main/java/org/apache/helix/tools/ClusterStateVerifier.java
@@ -31,6 +31,7 @@ import java.util.concurrent.TimeUnit;
 
 import org.I0Itec.zkclient.IZkChildListener;
 import org.I0Itec.zkclient.IZkDataListener;
+import org.I0Itec.zkclient.exception.ZkNodeExistsException;
 import org.apache.commons.cli.CommandLine;
 import org.apache.commons.cli.CommandLineParser;
 import org.apache.commons.cli.GnuParser;
@@ -262,9 +263,9 @@ public class ClusterStateVerifier {
       }
 
       // filter out all resources that use Task state model
-      Iterator it = idealStates.entrySet().iterator();
+      Iterator<Map.Entry<String, IdealState>> it = idealStates.entrySet().iterator();
       while (it.hasNext()) {
-        Map.Entry<String, IdealState> pair = (Map.Entry<String, IdealState>)it.next();
+        Map.Entry<String, IdealState> pair = it.next();
         if (pair.getValue().getStateModelDefRef().equals(TaskConstants.STATE_MODEL_NAME)) {
           it.remove();
         }
@@ -554,6 +555,13 @@ public class ClusterStateVerifier {
     return verifyByZkCallback(verifier, 30000);
   }
 
+  /**
+   * This function should be always single threaded
+   *
+   * @param verifier
+   * @param timeout
+   * @return
+   */
   public static boolean verifyByZkCallback(ZkVerifier verifier, long timeout) {
     long startTime = System.currentTimeMillis();
     CountDownLatch countDown = new CountDownLatch(1);
@@ -562,7 +570,12 @@ public class ClusterStateVerifier {
 
     // add an ephemeral node to /{clusterName}/CONFIGS/CLUSTER/verify
     // so when analyze zk log, we know when a test ends
-    zkClient.createEphemeral("/" + clusterName + "/CONFIGS/CLUSTER/verify");
+    try {
+      zkClient.createEphemeral("/" + clusterName + "/CONFIGS/CLUSTER/verify");
+    } catch (ZkNodeExistsException ex) {
+      LOG.error("There is already a verification in progress", ex);
+      throw ex;
+    }
 
     ExtViewVeriferZkListener listener = new ExtViewVeriferZkListener(countDown, zkClient, verifier);