ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject ambari git commit: AMBARI-14943 AMS check failed on deploy (dsen)
Date Fri, 05 Feb 2016 17:52:34 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk b567ca441 -> 13325ab07


AMBARI-14943 AMS check failed on deploy (dsen)


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

Branch: refs/heads/trunk
Commit: 13325ab07821cdfc3813457c0ca05c6b065f5879
Parents: b567ca4
Author: Dmytro Sen <dsen@apache.org>
Authored: Fri Feb 5 19:52:19 2016 +0200
Committer: Dmytro Sen <dsen@apache.org>
Committed: Fri Feb 5 19:52:19 2016 +0200

----------------------------------------------------------------------
 .../metrics/timeline/PhoenixHBaseAccessor.java  | 51 ++++++++++++--------
 .../webapp/TimelineWebServices.java             |  7 +--
 .../timeline/PhoenixHBaseAccessorTest.java      |  2 +-
 3 files changed, 33 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/13325ab0/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/PhoenixHBaseAccessor.java
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/PhoenixHBaseAccessor.java
b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/PhoenixHBaseAccessor.java
index 29662f3..7fa1d2d 100644
--- a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/PhoenixHBaseAccessor.java
+++ b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/PhoenixHBaseAccessor.java
@@ -555,34 +555,43 @@ public class PhoenixHBaseAccessor {
         throw new IllegalArgumentException("Multiple aggregate functions not supported.");
       }
       for (Function f : functions) {
-        SingleValuedTimelineMetric metric =
-          TIMELINE_METRIC_READ_HELPER.getAggregatedTimelineMetricFromResultSet(rs, f);
-
-        if (condition.isGrouped()) {
-          metrics.addOrMergeTimelineMetric(metric);
+        if (f.getReadFunction() == Function.ReadFunction.VALUE) {
+          getTimelineMetricsFromResultSet(metrics, condition, rs);
         } else {
-          metrics.getMetrics().add(metric.getTimelineMetric());
+          SingleValuedTimelineMetric metric =
+            TIMELINE_METRIC_READ_HELPER.getAggregatedTimelineMetricFromResultSet(rs, f);
+
+          if (condition.isGrouped()) {
+            metrics.addOrMergeTimelineMetric(metric);
+          } else {
+            metrics.getMetrics().add(metric.getTimelineMetric());
+          }
         }
       }
     } else {
       // No aggregation requested
-      if (condition.getPrecision().equals(Precision.SECONDS)) {
-        TimelineMetric metric = TIMELINE_METRIC_READ_HELPER.getTimelineMetricFromResultSet(rs);
-        if (condition.isGrouped()) {
-          metrics.addOrMergeTimelineMetric(metric);
-        } else {
-          metrics.getMetrics().add(metric);
-        }
+      // Execution never goes here, function always contain at least 1 element
+      getTimelineMetricsFromResultSet(metrics, condition, rs);
+    }
+  }
 
+  private void getTimelineMetricsFromResultSet(TimelineMetrics metrics, Condition condition,
ResultSet rs) throws SQLException, IOException {
+    if (condition.getPrecision().equals(Precision.SECONDS)) {
+      TimelineMetric metric = TIMELINE_METRIC_READ_HELPER.getTimelineMetricFromResultSet(rs);
+      if (condition.isGrouped()) {
+        metrics.addOrMergeTimelineMetric(metric);
       } else {
-        SingleValuedTimelineMetric metric =
-          TIMELINE_METRIC_READ_HELPER.getAggregatedTimelineMetricFromResultSet(rs,
-            Function.DEFAULT_VALUE_FUNCTION);
-        if (condition.isGrouped()) {
-          metrics.addOrMergeTimelineMetric(metric);
-        } else {
-          metrics.getMetrics().add(metric.getTimelineMetric());
-        }
+        metrics.getMetrics().add(metric);
+      }
+
+    } else {
+      SingleValuedTimelineMetric metric =
+        TIMELINE_METRIC_READ_HELPER.getAggregatedTimelineMetricFromResultSet(rs,
+          Function.DEFAULT_VALUE_FUNCTION);
+      if (condition.isGrouped()) {
+        metrics.addOrMergeTimelineMetric(metric);
+      } else {
+        metrics.getMetrics().add(metric.getTimelineMetric());
       }
     }
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/13325ab0/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/TimelineWebServices.java
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/TimelineWebServices.java
b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/TimelineWebServices.java
index e9d77cc..873671a 100644
--- a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/TimelineWebServices.java
+++ b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/TimelineWebServices.java
@@ -20,7 +20,6 @@ package org.apache.hadoop.yarn.server.applicationhistoryservice.webapp;
 
 import com.google.inject.Inject;
 import com.google.inject.Singleton;
-import org.apache.commons.lang.StringUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.classification.InterfaceAudience.Public;
@@ -386,11 +385,9 @@ public class TimelineWebServices {
       throw new PrecisionLimitExceededException(iae.getMessage());
     } catch (IllegalArgumentException iae) {
       throw new BadRequestException(iae.getMessage());
-    } catch (SQLException sql) {
-      throw new WebApplicationException(sql,
+    } catch (SQLException | IOException e) {
+      throw new WebApplicationException(e,
         Response.Status.INTERNAL_SERVER_ERROR);
-    } catch (IOException io) {
-      throw new WebApplicationException(io, Response.Status.INTERNAL_SERVER_ERROR);
     }
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/13325ab0/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/PhoenixHBaseAccessorTest.java
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/PhoenixHBaseAccessorTest.java
b/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/PhoenixHBaseAccessorTest.java
index 0a6f120..9838bca 100644
--- a/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/PhoenixHBaseAccessorTest.java
+++ b/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/PhoenixHBaseAccessorTest.java
@@ -181,7 +181,7 @@ public class PhoenixHBaseAccessorTest {
     PowerMock.replayAll();
     EasyMock.replay(preparedStatementMock, rsMock, pioe1, pioe2, dnrioe);
     try {
-      TimelineMetrics tml = accessor.getMetricRecords(condition, metricFunctions);
+      accessor.getMetricRecords(condition, metricFunctions);
       fail();
     } catch (Exception e) {
       //NOP


Mime
View raw message