You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ds...@apache.org on 2015/08/11 20:27:46 UTC

ambari git commit: AMBARI-12718 AMS is doing a (Select *) for certain point in time metrics from Dashboard page (additional patch) (dsen)

Repository: ambari
Updated Branches:
  refs/heads/trunk 12c002c2c -> 6ac03f043


AMBARI-12718 AMS is doing a (Select *) for certain point in time metrics from Dashboard page (additional patch) (dsen)


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

Branch: refs/heads/trunk
Commit: 6ac03f0433118105a51ffb581c608256d8de80e3
Parents: 12c002c
Author: Dmytro Sen <ds...@apache.org>
Authored: Tue Aug 11 21:27:23 2015 +0300
Committer: Dmytro Sen <ds...@apache.org>
Committed: Tue Aug 11 21:27:23 2015 +0300

----------------------------------------------------------------------
 .../metrics/timeline/query/PhoenixTransactSQL.java        | 10 +++++-----
 .../metrics/timeline/TestPhoenixTransactSQL.java          |  6 +++---
 2 files changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/6ac03f04/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/query/PhoenixTransactSQL.java
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/query/PhoenixTransactSQL.java b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/query/PhoenixTransactSQL.java
index ed80474..1aa6204 100644
--- a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/query/PhoenixTransactSQL.java
+++ b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/query/PhoenixTransactSQL.java
@@ -443,16 +443,16 @@ public class PhoenixTransactSQL {
       stmtStr = condition.getStatement();
     } else {
       //if not a single metric for a single host
-      if (condition.getHostnames().size() > 1
-        && condition.getMetricNames().size() > 1) {
-        stmtStr = String.format(GET_LATEST_METRIC_SQL,
+      if (condition.getHostnames().size() == 1
+        && condition.getMetricNames().size() == 1) {
+        stmtStr = String.format(GET_LATEST_METRIC_SQL_SINGLE_HOST,
           METRICS_RECORD_TABLE_NAME,
+          condition.getConditionClause(),
           METRICS_RECORD_TABLE_NAME,
           condition.getConditionClause());
       } else {
-        stmtStr = String.format(GET_LATEST_METRIC_SQL_SINGLE_HOST,
+        stmtStr = String.format(GET_LATEST_METRIC_SQL,
           METRICS_RECORD_TABLE_NAME,
-          condition.getConditionClause(),
           METRICS_RECORD_TABLE_NAME,
           condition.getConditionClause());
       }

http://git-wip-us.apache.org/repos/asf/ambari/blob/6ac03f04/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/TestPhoenixTransactSQL.java
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/TestPhoenixTransactSQL.java b/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/TestPhoenixTransactSQL.java
index 98738af..cf64e4e 100644
--- a/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/TestPhoenixTransactSQL.java
+++ b/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/TestPhoenixTransactSQL.java
@@ -225,7 +225,7 @@ public class TestPhoenixTransactSQL {
   @Test
   public void testPrepareGetLatestMetricSqlStmtSingleHostName() throws SQLException {
     Condition condition = new DefaultCondition(
-      Arrays.asList("cpu_user", "mem_free"), Collections.singletonList("h1"),
+      Arrays.asList("cpu_user"), Collections.singletonList("h1"),
       "a1", "i1", null, null, null, null, false);
     Connection connection = createNiceMock(Connection.class);
     PreparedStatement preparedStatement = createNiceMock(PreparedStatement.class);
@@ -235,10 +235,10 @@ public class TestPhoenixTransactSQL {
         .andReturn(preparedStatement);
     expect(preparedStatement.getParameterMetaData())
       .andReturn(parameterMetaData).times(2);
-    // 10 = (1 instance_id + 1 appd_id + 1 hostname + 2 metric names) * 2,
+    // 8 = (1 instance_id + 1 appd_id + 1 hostname + 1 metric name) * 2,
     // For GET_LATEST_METRIC_SQL_SINGLE_HOST parameters should be set 2 times
     expect(parameterMetaData.getParameterCount())
-      .andReturn(10).times(2);
+      .andReturn(8).times(2);
 
     replay(connection, preparedStatement, parameterMetaData);
     PhoenixTransactSQL.prepareGetLatestMetricSqlStmt(connection, condition);