ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From avija...@apache.org
Subject [1/2] ambari git commit: Revert "AMBARI-18012 : Metrics Sink unable to connect to zookeeper to locate collector host. (avijayan)"
Date Fri, 12 Aug 2016 15:11:35 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 9696b62af -> 7a6f710e2


Revert "AMBARI-18012 : Metrics Sink unable to connect to zookeeper to locate collector host.
(avijayan)"

This reverts commit 9696b62afb98a7e94815e9aec26692d533cad12a.


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

Branch: refs/heads/trunk
Commit: 212927a416c3edec6e20c25217b6f28fc1f7e55b
Parents: 9696b62
Author: Aravindan Vijayan <avijayan@hortonworks.com>
Authored: Fri Aug 12 08:11:16 2016 -0700
Committer: Aravindan Vijayan <avijayan@hortonworks.com>
Committed: Fri Aug 12 08:11:16 2016 -0700

----------------------------------------------------------------------
 .../availability/MetricCollectorHAHelper.java      | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/212927a4/ambari-metrics/ambari-metrics-common/src/main/java/org/apache/hadoop/metrics2/sink/timeline/availability/MetricCollectorHAHelper.java
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-common/src/main/java/org/apache/hadoop/metrics2/sink/timeline/availability/MetricCollectorHAHelper.java
b/ambari-metrics/ambari-metrics-common/src/main/java/org/apache/hadoop/metrics2/sink/timeline/availability/MetricCollectorHAHelper.java
index 4d0ec14..7b13362 100644
--- a/ambari-metrics/ambari-metrics-common/src/main/java/org/apache/hadoop/metrics2/sink/timeline/availability/MetricCollectorHAHelper.java
+++ b/ambari-metrics/ambari-metrics-common/src/main/java/org/apache/hadoop/metrics2/sink/timeline/availability/MetricCollectorHAHelper.java
@@ -22,12 +22,13 @@ import org.apache.commons.logging.LogFactory;
 import org.apache.curator.CuratorZookeeperClient;
 import org.apache.curator.RetryLoop;
 import org.apache.curator.RetryPolicy;
+import org.apache.curator.retry.RetryOneTime;
 import org.apache.curator.retry.RetryUntilElapsed;
 import org.apache.zookeeper.ZooKeeper;
 
+import java.net.HttpURLConnection;
 import java.util.Collection;
 import java.util.HashSet;
-import java.util.List;
 import java.util.Set;
 import java.util.concurrent.Callable;
 
@@ -42,7 +43,7 @@ public class MetricCollectorHAHelper {
   private final int sleepMsBetweenRetries;
 
   private static final int CONNECTION_TIMEOUT = 2000;
-  private static final int SESSION_TIMEOUT = 10000;
+  private static final int SESSION_TIMEOUT = 5000;
   private static final String ZK_PATH = "/ambari-metrics-cluster/LIVEINSTANCES";
   private static final String INSTANCE_NAME_DELIMITER = "_";
 
@@ -67,15 +68,15 @@ public class MetricCollectorHAHelper {
     final CuratorZookeeperClient client = new CuratorZookeeperClient(zookeeperQuorum,
       SESSION_TIMEOUT, CONNECTION_TIMEOUT, null, retryPolicy);
 
-    List<String> liveInstances = null;
+    String liveInstances = null;
 
     try {
-      client.start();
-      liveInstances = RetryLoop.callWithRetry(client, new Callable<List<String>>()
{
+      liveInstances = RetryLoop.callWithRetry(client, new Callable<String>() {
         @Override
-        public List<String> call() throws Exception {
+        public String call() throws Exception {
           ZooKeeper zookeeper = client.getZooKeeper();
-          return zookeeper.getChildren(ZK_PATH, false);
+          byte[] data = zookeeper.getData(ZK_PATH, null, null);
+          return data != null ? new String(data) : null;
         }
       });
     } catch (Exception e) {
@@ -85,7 +86,7 @@ public class MetricCollectorHAHelper {
 
     // [ambari-sid-3.c.pramod-thangali.internal_12001]
     if (liveInstances != null && !liveInstances.isEmpty()) {
-      for (String instanceStr : liveInstances) {
+      for (String instanceStr : liveInstances.split(",")) {
         collectors.add(instanceStr.substring(0, instanceStr.indexOf(INSTANCE_NAME_DELIMITER)));
       }
     }


Mime
View raw message