ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From swa...@apache.org
Subject git commit: AMBARI-5707. Fastdiff bug and other fixes.
Date Fri, 26 Sep 2014 02:23:28 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-metrics-dev ab81ebda9 -> 3ea2d8cea


AMBARI-5707. Fastdiff bug and other fixes.


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

Branch: refs/heads/branch-metrics-dev
Commit: 3ea2d8cea23747ab0264ba482228f806a8a71f97
Parents: ab81ebd
Author: Siddharth Wagle <swagle@hortonworks.com>
Authored: Thu Sep 25 19:22:36 2014 -0700
Committer: Siddharth Wagle <swagle@hortonworks.com>
Committed: Thu Sep 25 19:22:36 2014 -0700

----------------------------------------------------------------------
 .../metrics/timeline/PhoenixHBaseAccessor.java  | 19 +++---
 .../metrics/timeline/PhoenixTransactSQL.java    | 70 ++++++++++++--------
 .../TimelineMetricAggregatorHourly.java         |  4 +-
 .../TimelineMetricAggregatorMinute.java         |  4 +-
 .../TimelineMetricClusterAggregator.java        |  4 ++
 5 files changed, 62 insertions(+), 39 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/3ea2d8ce/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/PhoenixHBaseAccessor.java
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/PhoenixHBaseAccessor.java
b/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/PhoenixHBaseAccessor.java
index bb03cd1..f11a889 100644
--- a/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/PhoenixHBaseAccessor.java
+++ b/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/PhoenixHBaseAccessor.java
@@ -43,6 +43,7 @@ import static org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.ti
 import static org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.PhoenixTransactSQL.CREATE_METRICS_CLUSTER_AGGREGATE_TABLE_SQL;
 import static org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.PhoenixTransactSQL.CREATE_METRICS_TABLE_SQL;
 import static org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.PhoenixTransactSQL.Condition;
+import static org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.PhoenixTransactSQL.DEFAULT_TABLE_COMPRESSION;
 import static org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.PhoenixTransactSQL.METRICS_RECORD_CACHE_TABLE_NAME;
 import static org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.PhoenixTransactSQL.METRICS_RECORD_CACHE_TABLE_TTL;
 import static org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.PhoenixTransactSQL.METRICS_RECORD_TABLE_NAME;
@@ -118,11 +119,11 @@ public class PhoenixHBaseAccessor {
     metric.setAppId(rs.getString("APP_ID"));
     metric.setInstanceId(rs.getString("INSTANCE_ID"));
     metric.setHostName(rs.getString("HOSTNAME"));
-    metric.setTimestamp(rs.getLong("TIMESTAMP"));
+    metric.setTimestamp(rs.getLong("SERVER_TIME"));
     metric.setStartTime(rs.getLong("START_TIME"));
     metric.setType(rs.getString("UNITS"));
     metric.setMetricValues(
-      (Map<Long, Double>) TimelineUtilsExt.readMetricFromJSON(
+      (Map<Long, Double>) TimelineUtils.readMetricFromJSON(
         rs.getString("METRICS")));
     return metric;
   }
@@ -134,7 +135,7 @@ public class PhoenixHBaseAccessor {
     metric.setAppId(rs.getString("APP_ID"));
     metric.setInstanceId(rs.getString("INSTANCE_ID"));
     metric.setHostName(rs.getString("HOSTNAME"));
-    metric.setTimestamp(rs.getLong("TIMESTAMP"));
+    metric.setTimestamp(rs.getLong("SERVER_TIME"));
     metric.setType(rs.getString("UNITS"));
     return metric;
   }
@@ -158,9 +159,11 @@ public class PhoenixHBaseAccessor {
       LOG.info("Initializing metrics schema...");
       stmt = conn.createStatement();
       stmt.executeUpdate(String.format(CREATE_METRICS_TABLE_SQL,
-        METRICS_RECORD_TABLE_NAME, METRICS_RECORD_TABLE_TTL));
+        METRICS_RECORD_TABLE_NAME, METRICS_RECORD_TABLE_TTL,
+        DEFAULT_TABLE_COMPRESSION));
       stmt.executeUpdate(String.format(CREATE_METRICS_TABLE_SQL,
-        METRICS_RECORD_CACHE_TABLE_NAME, METRICS_RECORD_CACHE_TABLE_TTL));
+        METRICS_RECORD_CACHE_TABLE_NAME, METRICS_RECORD_CACHE_TABLE_TTL,
+        "NONE"));
       stmt.executeUpdate(CREATE_METRICS_AGGREGATE_HOURLY_TABLE_SQL);
       stmt.executeUpdate(CREATE_METRICS_AGGREGATE_MINUTE_TABLE_SQL);
       stmt.executeUpdate(CREATE_METRICS_CLUSTER_AGGREGATE_TABLE_SQL);
@@ -518,10 +521,10 @@ public class PhoenixHBaseAccessor {
         metric.setMetricName(rs.getString("METRIC_NAME"));
         metric.setAppId(rs.getString("APP_ID"));
         metric.setInstanceId(rs.getString("INSTANCE_ID"));
-        metric.setTimestamp(rs.getLong("TIMESTAMP"));
-        metric.setStartTime(rs.getLong("TIMESTAMP"));
+        metric.setTimestamp(rs.getLong("SERVER_TIME"));
+        metric.setStartTime(rs.getLong("SERVER_TIME"));
         Map<Long, Double> valueMap = new HashMap<Long, Double>();
-        valueMap.put(rs.getLong("TIMESTAMP"), rs.getDouble("METRIC_SUM") /
+        valueMap.put(rs.getLong("SERVER_TIME"), rs.getDouble("METRIC_SUM") /
                                               rs.getInt("HOSTS_COUNT"));
         metric.setMetricValues(valueMap);
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/3ea2d8ce/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/PhoenixTransactSQL.java
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/PhoenixTransactSQL.java
b/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/PhoenixTransactSQL.java
index c0ddb89..a52fd4b 100644
--- a/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/PhoenixTransactSQL.java
+++ b/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/PhoenixTransactSQL.java
@@ -23,8 +23,7 @@ import org.apache.commons.logging.LogFactory;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.HashSet;
+import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Set;
 
@@ -40,80 +39,89 @@ public class PhoenixTransactSQL {
   */
   public static final String CREATE_METRICS_TABLE_SQL = "CREATE TABLE IF NOT " +
     "EXISTS %s (METRIC_NAME VARCHAR, " +
-    "HOSTNAME VARCHAR, TIMESTAMP UNSIGNED_LONG NOT NULL, " +
+    "HOSTNAME VARCHAR, SERVER_TIME UNSIGNED_LONG NOT NULL, " +
     "APP_ID VARCHAR, INSTANCE_ID VARCHAR, " +
     "START_TIME UNSIGNED_LONG, UNITS CHAR(20), " +
     "METRIC_AVG DOUBLE, METRIC_MAX DOUBLE, METRIC_MIN DOUBLE, " +
     "METRICS VARCHAR CONSTRAINT pk " +
-    "PRIMARY KEY (METRIC_NAME, HOSTNAME, TIMESTAMP, APP_ID, INSTANCE_ID)) " +
-    "IMMUTABLE_ROWS=true, TTL=%s, COMPRESSION='SNAPPY'";
+    "PRIMARY KEY (METRIC_NAME, HOSTNAME, SERVER_TIME, APP_ID, " +
+    "INSTANCE_ID)) DATA_BLOCK_ENCODING='NONE', IMMUTABLE_ROWS=true, TTL=%s, " +
+    "COMPRESSION='%s'";
 
   public static final String CREATE_METRICS_AGGREGATE_HOURLY_TABLE_SQL =
     "CREATE TABLE IF NOT EXISTS METRIC_RECORD_HOURLY " +
     "(METRIC_NAME VARCHAR, HOSTNAME VARCHAR, " +
-    "APP_ID VARCHAR, INSTANCE_ID VARCHAR, TIMESTAMP UNSIGNED_LONG NOT NULL, " +
+    "APP_ID VARCHAR, INSTANCE_ID VARCHAR, " +
+    "SERVER_TIME UNSIGNED_LONG NOT NULL, " +
     "UNITS CHAR(20), METRIC_AVG DOUBLE, METRIC_MAX DOUBLE," +
     "METRIC_MIN DOUBLE CONSTRAINT pk " +
-    "PRIMARY KEY (METRIC_NAME, HOSTNAME, APP_ID, INSTANCE_ID, TIMESTAMP)) " +
-    "IMMUTABLE_ROWS=true, TTL=2592000, COMPRESSION='SNAPPY'";
+    "PRIMARY KEY (METRIC_NAME, HOSTNAME, APP_ID, INSTANCE_ID, " +
+    "SERVER_TIME)) DATA_BLOCK_ENCODING='NONE', IMMUTABLE_ROWS=true, TTL=2592000, " +
+    "COMPRESSION='SNAPPY'";
 
   public static final String CREATE_METRICS_AGGREGATE_MINUTE_TABLE_SQL =
     "CREATE TABLE IF NOT EXISTS METRIC_RECORD_MINUTE " +
     "(METRIC_NAME VARCHAR, HOSTNAME VARCHAR, " +
-    "APP_ID VARCHAR, INSTANCE_ID VARCHAR, TIMESTAMP UNSIGNED_LONG NOT NULL, " +
+    "APP_ID VARCHAR, INSTANCE_ID VARCHAR, " +
+    "SERVER_TIME UNSIGNED_LONG NOT NULL, " +
     "UNITS CHAR(20), METRIC_AVG DOUBLE, METRIC_MAX DOUBLE," +
     "METRIC_MIN DOUBLE CONSTRAINT pk " +
-    "PRIMARY KEY (METRIC_NAME, HOSTNAME, APP_ID, INSTANCE_ID, TIMESTAMP)) " +
-    "IMMUTABLE_ROWS=true, TTL=604800, COMPRESSION='SNAPPY'";
+    "PRIMARY KEY (METRIC_NAME, HOSTNAME, APP_ID, INSTANCE_ID, " +
+    "SERVER_TIME)) DATA_BLOCK_ENCODING='NONE', IMMUTABLE_ROWS=true, TTL=604800, " +
+    "COMPRESSION='SNAPPY'";
 
   public static final String CREATE_METRICS_CLUSTER_AGGREGATE_TABLE_SQL =
     "CREATE TABLE IF NOT EXISTS METRIC_AGGREGATE " +
     "(METRIC_NAME VARCHAR, APP_ID VARCHAR, INSTANCE_ID VARCHAR, " +
-    "TIMESTAMP UNSIGNED_LONG NOT NULL, UNITS CHAR(20), METRIC_SUM DOUBLE, " +
+    "SERVER_TIME UNSIGNED_LONG NOT NULL, " +
+    "UNITS CHAR(20), METRIC_SUM DOUBLE, " +
     "HOSTS_COUNT UNSIGNED_INT, METRIC_MAX DOUBLE, METRIC_MIN DOUBLE " +
-    "CONSTRAINT pk PRIMARY KEY (METRIC_NAME, APP_ID, INSTANCE_ID, TIMESTAMP)) " +
-    "IMMUTABLE_ROWS=true, TTL=2592000, COMPRESSION='SNAPPY'";
+    "CONSTRAINT pk PRIMARY KEY (METRIC_NAME, APP_ID, INSTANCE_ID, " +
+    "SERVER_TIME)) DATA_BLOCK_ENCODING='NONE', IMMUTABLE_ROWS=true, TTL=2592000, " +
+    "COMPRESSION='SNAPPY'";
 
   public static final String CREATE_METRICS_CLUSTER_AGGREGATE_HOURLY_TABLE_SQL =
     "CREATE TABLE IF NOT EXISTS METRIC_AGGREGATE_HOURLY " +
     "(METRIC_NAME VARCHAR, APP_ID VARCHAR, INSTANCE_ID VARCHAR, " +
-    "TIMESTAMP UNSIGNED_LONG NOT NULL, UNITS CHAR(20), METRIC_AVG DOUBLE, " +
+    "SERVER_TIME UNSIGNED_LONG NOT NULL, " +
+    "UNITS CHAR(20), METRIC_AVG DOUBLE, " +
     "METRIC_MAX DOUBLE, METRIC_MIN DOUBLE " +
-    "CONSTRAINT pk PRIMARY KEY (METRIC_NAME, APP_ID, INSTANCE_ID, TIMESTAMP)) " +
-    "IMMUTABLE_ROWS=true, TTL=31536000, COMPRESSION='SNAPPY'";
+    "CONSTRAINT pk PRIMARY KEY (METRIC_NAME, APP_ID, INSTANCE_ID, " +
+    "SERVER_TIME)) DATA_BLOCK_ENCODING='NONE', IMMUTABLE_ROWS=true, TTL=31536000, " +
+    "COMPRESSION='SNAPPY'";
 
   /**
    * Insert into metric records table.
    */
   public static final String UPSERT_METRICS_SQL = "UPSERT INTO %s " +
-    "(METRIC_NAME, HOSTNAME, APP_ID, INSTANCE_ID, TIMESTAMP, START_TIME, " +
+    "(METRIC_NAME, HOSTNAME, APP_ID, INSTANCE_ID, SERVER_TIME, START_TIME, " +
     "UNITS, METRIC_AVG, METRIC_MAX, METRIC_MIN, METRICS) VALUES " +
     "(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
 
   public static final String UPSERT_CLUSTER_AGGREGATE_SQL = "UPSERT INTO " +
-    "METRIC_AGGREGATE (METRIC_NAME, APP_ID, INSTANCE_ID, TIMESTAMP, " +
+    "METRIC_AGGREGATE (METRIC_NAME, APP_ID, INSTANCE_ID, SERVER_TIME, " +
     "UNITS, METRIC_SUM, HOSTS_COUNT, METRIC_MAX, METRIC_MIN) " +
     "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)";
 
   public static final String UPSERT_AGGREGATE_RECORD_SQL = "UPSERT INTO " +
     "%s (METRIC_NAME, HOSTNAME, APP_ID, INSTANCE_ID, " +
-    "TIMESTAMP, UNITS, METRIC_AVG, METRIC_MAX, METRIC_MIN) " +
+    "SERVER_TIME, UNITS, METRIC_AVG, METRIC_MAX, METRIC_MIN) " +
     "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)";
 
   /**
    * Retrieve a set of rows from metrics records table.
    */
   public static final String GET_METRIC_SQL = "SELECT METRIC_NAME, " +
-    "HOSTNAME, APP_ID, INSTANCE_ID, TIMESTAMP, START_TIME, UNITS, METRIC_AVG, " +
+    "HOSTNAME, APP_ID, INSTANCE_ID, SERVER_TIME, START_TIME, UNITS, METRIC_AVG, " +
     "METRIC_MAX, METRIC_MIN, METRICS FROM %s";
 
   public static final String GET_METRIC_AGGREGATE_ONLY_SQL = "SELECT " +
-    "/* RANGE_SCAN */ METRIC_NAME, HOSTNAME, APP_ID, INSTANCE_ID, TIMESTAMP, " +
+    "METRIC_NAME, HOSTNAME, APP_ID, INSTANCE_ID, SERVER_TIME, " +
     "UNITS, METRIC_AVG, METRIC_MAX, METRIC_MIN FROM %s";
 
   public static final String GET_CLUSTER_AGGREGATE_SQL =
     "SELECT METRIC_NAME, APP_ID, " +
-    "INSTANCE_ID, TIMESTAMP, METRIC_SUM, HOSTS_COUNT, METRIC_MAX, " +
+    "INSTANCE_ID, SERVER_TIME, METRIC_SUM, HOSTS_COUNT, METRIC_MAX, " +
     "METRIC_MIN FROM METRIC_AGGREGATE";
 
   /**
@@ -130,6 +138,7 @@ public class PhoenixTransactSQL {
     "METRIC_RECORD_MINUTE";
   public static final String METRICS_AGGREGATE_HOURLY_TABLE_NAME =
     "METRIC_RECORD_HOURLY";
+  public static final String DEFAULT_TABLE_COMPRESSION = "SNAPPY";
 
   public static PreparedStatement prepareGetMetricsSqlStmt(
       Connection connection, Condition condition) throws SQLException {
@@ -137,7 +146,7 @@ public class PhoenixTransactSQL {
     if (condition.isEmpty()) {
       throw new IllegalArgumentException("Condition is empty.");
     }
-    String stmtStr = GET_METRIC_SQL;
+    String stmtStr = String.format(GET_METRIC_SQL, METRICS_RECORD_TABLE_NAME);
     if (condition.getStatement() != null) {
       stmtStr = condition.getStatement();
     }
@@ -146,10 +155,11 @@ public class PhoenixTransactSQL {
     sb.append(" WHERE ");
     sb.append(condition.getConditionClause());
     String orderByClause = condition.getOrderByClause();
+
     if (orderByClause != null) {
       sb.append(orderByClause);
     } else {
-      sb.append(" ORDER BY METRIC_NAME, TIMESTAMP");
+      sb.append(" ORDER BY METRIC_NAME, SERVER_TIME ");
     }
     if (condition.getLimit() != null) {
       sb.append(" LIMIT ").append(condition.getLimit());
@@ -196,7 +206,7 @@ public class PhoenixTransactSQL {
     StringBuilder sb = new StringBuilder(GET_CLUSTER_AGGREGATE_SQL);
     sb.append(" WHERE ");
     sb.append(condition.getConditionClause());
-    sb.append(" ORDER BY METRIC_NAME, TIMESTAMP");
+    sb.append(" ORDER BY METRIC_NAME, SERVER_TIME");
     if (condition.getLimit() != null) {
       sb.append(" LIMIT ").append(condition.getLimit());
     }
@@ -238,7 +248,7 @@ public class PhoenixTransactSQL {
     boolean noLimit = false;
     Integer fetchSize;
     String statement;
-    Set<String> orderByColumns = new HashSet<String>();
+    Set<String> orderByColumns = new LinkedHashSet<String>();
 
     Condition(List<String> metricNames, String hostname, String appId,
               String instanceId, Long startTime, Long endTime, Integer limit,
@@ -319,14 +329,14 @@ public class PhoenixTransactSQL {
       }
       appendConjunction = false;
       if (getStartTime() != null) {
-        sb.append(" TIMESTAMP >= ?");
+        sb.append(" SERVER_TIME >= ?");
         appendConjunction = true;
       }
       if (appendConjunction) {
         sb.append(" AND");
       }
       if (getEndTime() != null) {
-        sb.append(" TIMESTAMP < ?");
+        sb.append(" SERVER_TIME < ?");
       }
       return sb.toString();
     }
@@ -408,6 +418,7 @@ public class PhoenixTransactSQL {
           }
           sb.append(orderByColumn);
         }
+        sb.append(" ");
         return sb.toString();
       }
       return null;
@@ -424,6 +435,7 @@ public class PhoenixTransactSQL {
         ", endTime=" + endTime +
         ", limit=" + limit +
         ", grouped=" + grouped +
+        ", orderBy=" + orderByColumns +
         ", noLimit=" + noLimit +
         '}';
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/3ea2d8ce/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/TimelineMetricAggregatorHourly.java
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/TimelineMetricAggregatorHourly.java
b/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/TimelineMetricAggregatorHourly.java
index 34b75aa..6418322 100644
--- a/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/TimelineMetricAggregatorHourly.java
+++ b/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/TimelineMetricAggregatorHourly.java
@@ -60,7 +60,9 @@ public class TimelineMetricAggregatorHourly extends AbstractTimelineAggregator
{
       METRICS_AGGREGATE_MINUTE_TABLE_NAME));
     condition.addOrderByColumn("METRIC_NAME");
     condition.addOrderByColumn("HOSTNAME");
-    condition.addOrderByColumn("TIMESTAMP");
+    condition.addOrderByColumn("APP_ID");
+    condition.addOrderByColumn("INSTANCE_ID");
+    condition.addOrderByColumn("SERVER_TIME");
 
     Connection conn = null;
     PreparedStatement stmt = null;

http://git-wip-us.apache.org/repos/asf/ambari/blob/3ea2d8ce/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/TimelineMetricAggregatorMinute.java
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/TimelineMetricAggregatorMinute.java
b/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/TimelineMetricAggregatorMinute.java
index 9d75aa9..bf8809c 100644
--- a/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/TimelineMetricAggregatorMinute.java
+++ b/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/TimelineMetricAggregatorMinute.java
@@ -60,7 +60,9 @@ public class TimelineMetricAggregatorMinute extends AbstractTimelineAggregator
{
       METRICS_RECORD_CACHE_TABLE_NAME));
     condition.addOrderByColumn("METRIC_NAME");
     condition.addOrderByColumn("HOSTNAME");
-    condition.addOrderByColumn("TIMESTAMP");
+    condition.addOrderByColumn("APP_ID");
+    condition.addOrderByColumn("INSTANCE_ID");
+    condition.addOrderByColumn("SERVER_TIME");
 
     Connection conn = null;
     PreparedStatement stmt = null;

http://git-wip-us.apache.org/repos/asf/ambari/blob/3ea2d8ce/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/TimelineMetricClusterAggregator.java
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/TimelineMetricClusterAggregator.java
b/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/TimelineMetricClusterAggregator.java
index fb979b5..d07eede 100644
--- a/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/TimelineMetricClusterAggregator.java
+++ b/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/TimelineMetricClusterAggregator.java
@@ -67,6 +67,10 @@ public class TimelineMetricClusterAggregator extends AbstractTimelineAggregator
     condition.setNoLimit();
     condition.setStatement(String.format(GET_METRIC_SQL,
       METRICS_RECORD_CACHE_TABLE_NAME));
+    condition.addOrderByColumn("METRIC_NAME");
+    condition.addOrderByColumn("APP_ID");
+    condition.addOrderByColumn("INSTANCE_ID");
+    condition.addOrderByColumn("SERVER_TIME");
 
     Connection conn;
     PreparedStatement stmt;


Mime
View raw message