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/03/05 01:42:12 UTC

ambari git commit: AMBARI-9914 Query for FLUME_HANDLER metrics takes several minutes (dsen)

Repository: ambari
Updated Branches:
  refs/heads/trunk 971f7878f -> d174383a5


AMBARI-9914 Query for FLUME_HANDLER metrics takes several minutes (dsen)


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

Branch: refs/heads/trunk
Commit: d174383a5826e19b96281e76edfd37d78c7180d8
Parents: 971f787
Author: Dmytro Sen <ds...@apache.org>
Authored: Thu Mar 5 02:41:39 2015 +0200
Committer: Dmytro Sen <ds...@apache.org>
Committed: Thu Mar 5 02:41:48 2015 +0200

----------------------------------------------------------------------
 .../metrics/timeline/PhoenixTransactSQL.java    | 21 +++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/d174383a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/PhoenixTransactSQL.java
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/PhoenixTransactSQL.java b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/PhoenixTransactSQL.java
index 80c6545..2cdefa9 100644
--- a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/PhoenixTransactSQL.java
+++ b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/PhoenixTransactSQL.java
@@ -283,7 +283,7 @@ public class PhoenixTransactSQL {
     StringBuilder sb = new StringBuilder(stmtStr);
     sb.append(" WHERE ");
     sb.append(condition.getConditionClause());
-    String orderByClause = condition.getOrderByClause();
+    String orderByClause = condition.getOrderByClause(true);
 
     if (orderByClause != null) {
       sb.append(orderByClause);
@@ -398,11 +398,11 @@ public class PhoenixTransactSQL {
     StringBuilder sb = new StringBuilder(stmtStr);
     sb.append(" WHERE ");
     sb.append(condition.getConditionClause());
-    String orderByClause = condition.getOrderByClause();
+    String orderByClause = condition.getOrderByClause(false);
     if (orderByClause != null) {
       sb.append(orderByClause);
     } else {
-      sb.append(" ORDER BY SERVER_TIME DESC, METRIC_NAME  ");
+      sb.append(" ORDER BY METRIC_NAME DESC, HOSTNAME DESC, SERVER_TIME DESC ");
     }
 
     sb.append(" LIMIT ").append(condition.getMetricNames().size());
@@ -533,11 +533,11 @@ public class PhoenixTransactSQL {
     StringBuilder sb = new StringBuilder(stmtStr);
     sb.append(" WHERE ");
     sb.append(condition.getConditionClause());
-    String orderByClause = condition.getOrderByClause();
+    String orderByClause = condition.getOrderByClause(false);
     if (orderByClause != null) {
       sb.append(orderByClause);
     } else {
-      sb.append(" ORDER BY SERVER_TIME DESC, METRIC_NAME  ");
+      sb.append(" ORDER BY METRIC_NAME DESC, SERVER_TIME DESC  ");
     }
 
     sb.append(" LIMIT ").append(condition.getMetricNames().size());
@@ -581,7 +581,7 @@ public class PhoenixTransactSQL {
     String getAppId();
     String getInstanceId();
     StringBuilder getConditionClause();
-    String getOrderByClause();
+    String getOrderByClause(boolean asc);
     String getStatement();
     Long getStartTime();
     Long getEndTime();
@@ -790,7 +790,7 @@ public class PhoenixTransactSQL {
       orderByColumns.add(column);
     }
 
-    public String getOrderByClause() {
+    public String getOrderByClause(boolean asc) {
       String orderByStr = " ORDER BY ";
       if (!orderByColumns.isEmpty()) {
         StringBuilder sb = new StringBuilder(orderByStr);
@@ -799,6 +799,9 @@ public class PhoenixTransactSQL {
             sb.append(", ");
           }
           sb.append(orderByColumn);
+          if (!asc) {
+            sb.append(" DESC");
+          }
         }
         sb.append(" ");
         return sb.toString();
@@ -912,8 +915,8 @@ public class PhoenixTransactSQL {
     }
 
     @Override
-    public String getOrderByClause() {
-      return adaptee.getOrderByClause();
+    public String getOrderByClause(boolean asc) {
+      return adaptee.getOrderByClause(asc);
     }
 
     @Override