From 0f33fcd50772a1af315b104c39b7ebb1d3a15d4e Mon Sep 17 00:00:00 2001 From: Zhijie Shen Date: Thu, 13 Nov 2014 13:47:42 -0800 Subject: [PATCH] YARN-2766. Made ApplicationHistoryManager return a sorted list of apps, attempts and containers. Contributed by Robert Kanter. (cherry picked from commit 3648cb57c9f018a3a339c26f5a0ca2779485521a) (cherry picked from commit 53d6c91df925c58e311ec7cd6a3adb952acc02f4) --- hadoop-yarn-project/CHANGES.txt | 3 +++ .../ApplicationHistoryManagerOnTimelineStore.java | 7 ++++--- .../TestApplicationHistoryClientService.java | 4 ++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index 45522c20c51..e2419d6a440 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -141,6 +141,9 @@ Release 2.6.1 - UNRELEASED YARN-3526. ApplicationMaster tracking URL is incorrectly redirected on a QJM cluster. (Weiwei Yang via xgong) + YARN-2766. Made ApplicationHistoryManager return a sorted list of apps, + attempts and containers. (Robert Kanter via zjshen) + Release 2.6.0 - 2014-11-18 INCOMPATIBLE CHANGES diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryManagerOnTimelineStore.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryManagerOnTimelineStore.java index ca7521f8733..f9ea14f0b64 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryManagerOnTimelineStore.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryManagerOnTimelineStore.java @@ -21,6 +21,7 @@ package org.apache.hadoop.yarn.server.applicationhistoryservice; import java.io.IOException; import java.util.EnumSet; import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; @@ -102,7 +103,7 @@ public class ApplicationHistoryManagerOnTimelineStore extends AbstractService null, null, Long.MAX_VALUE, EnumSet.allOf(Field.class), UserGroupInformation.getLoginUser()); Map apps = - new HashMap(); + new LinkedHashMap(); if (entities != null && entities.getEntities() != null) { for (TimelineEntity entity : entities.getEntities()) { ApplicationReportExt app = @@ -128,7 +129,7 @@ public class ApplicationHistoryManagerOnTimelineStore extends AbstractService Long.MAX_VALUE, EnumSet.allOf(Field.class), UserGroupInformation.getLoginUser()); Map appAttempts = - new HashMap(); + new LinkedHashMap(); for (TimelineEntity entity : entities.getEntities()) { ApplicationAttemptReport appAttempt = convertToApplicationAttemptReport(entity); @@ -198,7 +199,7 @@ public class ApplicationHistoryManagerOnTimelineStore extends AbstractService null, null, Long.MAX_VALUE, EnumSet.allOf(Field.class), UserGroupInformation.getLoginUser()); Map containers = - new HashMap(); + new LinkedHashMap(); if (entities != null && entities.getEntities() != null) { for (TimelineEntity entity : entities.getEntities()) { ContainerReport container = convertToContainerReport( diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestApplicationHistoryClientService.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestApplicationHistoryClientService.java index f0c44335459..b3fb3de4332 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestApplicationHistoryClientService.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestApplicationHistoryClientService.java @@ -168,7 +168,7 @@ public class TestApplicationHistoryClientService { clientService.getContainers(request); List containers = response.getContainerList(); Assert.assertNotNull(containers); - Assert.assertEquals(containerId, containers.get(1).getContainerId()); - Assert.assertEquals(containerId1, containers.get(0).getContainerId()); + Assert.assertEquals(containerId, containers.get(0).getContainerId()); + Assert.assertEquals(containerId1, containers.get(1).getContainerId()); } }