ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From avija...@apache.org
Subject ambari git commit: AMBARI-18900 : Zookeeper service check fails after deployment. (avijayan)
Date Thu, 17 Nov 2016 21:50:13 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk c97d785bf -> bd4c85718


AMBARI-18900 : Zookeeper service check fails after deployment. (avijayan)


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

Branch: refs/heads/trunk
Commit: bd4c85718f07c07281ea93c83c67028a611e61b1
Parents: c97d785
Author: Aravindan Vijayan <avijayan@hortonworks.com>
Authored: Thu Nov 17 13:50:04 2016 -0800
Committer: Aravindan Vijayan <avijayan@hortonworks.com>
Committed: Thu Nov 17 13:50:04 2016 -0800

----------------------------------------------------------------------
 .../sink/timeline/AbstractTimelineMetricsSink.java        |  5 +++--
 .../timeline/availability/MetricCollectorHAHelper.java    |  6 ++++++
 .../sink/timeline/availability/MetricCollectorHATest.java | 10 +++++++++-
 3 files changed, 18 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/bd4c8571/ambari-metrics/ambari-metrics-common/src/main/java/org/apache/hadoop/metrics2/sink/timeline/AbstractTimelineMetricsSink.java
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-common/src/main/java/org/apache/hadoop/metrics2/sink/timeline/AbstractTimelineMetricsSink.java
b/ambari-metrics/ambari-metrics-common/src/main/java/org/apache/hadoop/metrics2/sink/timeline/AbstractTimelineMetricsSink.java
index 173e675..769d0c1 100644
--- a/ambari-metrics/ambari-metrics-common/src/main/java/org/apache/hadoop/metrics2/sink/timeline/AbstractTimelineMetricsSink.java
+++ b/ambari-metrics/ambari-metrics-common/src/main/java/org/apache/hadoop/metrics2/sink/timeline/AbstractTimelineMetricsSink.java
@@ -341,8 +341,9 @@ public abstract class AbstractTimelineMetricsSink {
 
     // Lookup Zookeeper for live hosts - max 10 seconds wait time
     if (allKnownLiveCollectors.size() == 0 && getZookeeperQuorum() != null) {
-      LOG.info("No live collectors from configuration. Requesting zookeeper...");
-      allKnownLiveCollectors.addAll(collectorHAHelper.findLiveCollectorHostsFromZNode());
+      //TODO : Bring back Zk fallback after proper curation.
+      LOG.info("No live collectors from configuration. Not requesting zookeeper...");
+      //allKnownLiveCollectors.addAll(collectorHAHelper.findLiveCollectorHostsFromZNode());
     }
 
     if (allKnownLiveCollectors.size() != 0) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/bd4c8571/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 e7f7cfd..54c2bdf 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
@@ -90,6 +90,12 @@ public class MetricCollectorHAHelper {
     } catch (Exception e) {
       LOG.warn("Unable to connect to zookeeper.", e);
       LOG.debug(e);
+    } finally {
+      try {
+        client.close();
+      } catch (Exception e) {
+        LOG.error("Caught exception while trying to close Zk connection.",e);
+      }
     }
 
     // [ambari-sid-3.c.pramod-thangali.internal_12001]

http://git-wip-us.apache.org/repos/asf/ambari/blob/bd4c8571/ambari-metrics/ambari-metrics-common/src/test/java/org/apache/hadoop/metrics2/sink/timeline/availability/MetricCollectorHATest.java
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-common/src/test/java/org/apache/hadoop/metrics2/sink/timeline/availability/MetricCollectorHATest.java
b/ambari-metrics/ambari-metrics-common/src/test/java/org/apache/hadoop/metrics2/sink/timeline/availability/MetricCollectorHATest.java
index 3d00270..a0bc2e8 100644
--- a/ambari-metrics/ambari-metrics-common/src/test/java/org/apache/hadoop/metrics2/sink/timeline/availability/MetricCollectorHATest.java
+++ b/ambari-metrics/ambari-metrics-common/src/test/java/org/apache/hadoop/metrics2/sink/timeline/availability/MetricCollectorHATest.java
@@ -24,6 +24,7 @@ import org.apache.curator.CuratorZookeeperClient;
 import org.apache.curator.retry.BoundedExponentialBackoffRetry;
 import org.apache.hadoop.metrics2.sink.timeline.AbstractTimelineMetricsSink;
 import org.apache.zookeeper.ZooKeeper;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.powermock.api.easymock.PowerMock;
@@ -48,6 +49,7 @@ import static org.powermock.api.easymock.PowerMock.verifyAll;
 @PrepareForTest({AbstractTimelineMetricsSink.class, URL.class, HttpURLConnection.class, MetricCollectorHAHelper.class})
 public class MetricCollectorHATest {
 
+  @Ignore
   @Test
   public void findCollectorUsingZKTest() throws Exception {
     InputStream is = createNiceMock(InputStream.class);
@@ -61,7 +63,10 @@ public class MetricCollectorHATest {
     expect(connection.getInputStream()).andReturn(is).anyTimes();
     expect(connection.getResponseCode()).andThrow(new IOException()).anyTimes();
     expect(haHelper.findLiveCollectorHostsFromZNode()).andReturn(
-      new ArrayList<String>() {{ add("h2"); add("h3"); }});
+      new ArrayList<String>() {{
+        add("h2");
+        add("h3");
+      }});
 
     replayAll();
     TestTimelineMetricsSink sink = new TestTimelineMetricsSink(haHelper);
@@ -91,6 +96,9 @@ public class MetricCollectorHATest {
     clientMock.start();
     expectLastCall().once();
 
+    clientMock.close();
+    expectLastCall().once();
+
     ZooKeeper zkMock = PowerMock.createMock(ZooKeeper.class);
     expect(clientMock.getZooKeeper()).andReturn(zkMock).once();
 


Mime
View raw message