From ed83fe61e20b2899da324d33ad485fe86b664a29 Mon Sep 17 00:00:00 2001 From: Jian He Date: Mon, 17 Mar 2014 18:06:17 +0000 Subject: [PATCH] Merge r1578486 from trunk. YARN-1830. Fixed TestRMRestart#testQueueMetricsOnRMRestart failure due to race condition when app is submitted. Contributed by Zhijie Shen git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1578487 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-yarn-project/CHANGES.txt | 3 +++ .../yarn/server/resourcemanager/TestRMRestart.java | 11 +++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index 9652e64f240..afedc6b4b60 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -474,6 +474,9 @@ Release 2.4.0 - UNRELEASED YARN-1789. ApplicationSummary does not escape newlines in the app name (Tsuyoshi OZAWA via jlowe) + YARN-1830. Fixed TestRMRestart#testQueueMetricsOnRMRestart failure due to + race condition when app is submitted. (Zhijie Shen via jianhe) + Release 2.3.1 - UNRELEASED INCOMPATIBLE CHANGES diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestRMRestart.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestRMRestart.java index 9bedb34524d..02235311327 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestRMRestart.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestRMRestart.java @@ -1614,7 +1614,7 @@ public class TestRMRestart { } @SuppressWarnings("resource") - @Test + @Test (timeout = 60000) public void testQueueMetricsOnRMRestart() throws Exception { conf.setInt(YarnConfiguration.RM_AM_MAX_ATTEMPTS, YarnConfiguration.DEFAULT_RM_AM_MAX_ATTEMPTS); @@ -1674,15 +1674,14 @@ public class TestRMRestart { ContainerState.COMPLETE, "Killed AM container", 143); containerStatuses.add(containerStatus); nm1.registerNode(containerStatuses); - int timeoutSecs = 0; - while (loadedApp1.getAppAttempts().size() != 2 && timeoutSecs++ < 40) {; + while (loadedApp1.getAppAttempts().size() != 2) { Thread.sleep(200); } - - assertQueueMetrics(qm2, 1, 1, 0, 0); - nm1.nodeHeartbeat(true); attempt1 = loadedApp1.getCurrentAppAttempt(); attemptId1 = attempt1.getAppAttemptId(); + rm2.waitForState(attemptId1, RMAppAttemptState.SCHEDULED); + assertQueueMetrics(qm2, 1, 1, 0, 0); + nm1.nodeHeartbeat(true); rm2.waitForState(attemptId1, RMAppAttemptState.ALLOCATED); assertQueueMetrics(qm2, 1, 0, 1, 0); am1 = rm2.sendAMLaunched(attempt1.getAppAttemptId());