From d2559ca307d0bd41b37bf8ebb93f773050970d19 Mon Sep 17 00:00:00 2001 From: Jian He Date: Fri, 1 Jul 2016 14:28:43 -0700 Subject: [PATCH] YARN-5023. TestAMRestart#testShouldNotCountFailureToMaxAttemptRetry fails. Contributed by sandflee (cherry picked from commit c35a5a7a8d85b42498e6981a6b1f09f2bdd56459) --- .../org/apache/hadoop/yarn/server/resourcemanager/MockRM.java | 4 ++++ .../org/apache/hadoop/yarn/server/resourcemanager/TestRM.java | 2 -- .../resourcemanager/applicationsmanager/TestAMRestart.java | 1 - 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/MockRM.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/MockRM.java index f7a210cd2dc..955fed9dddc 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/MockRM.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/MockRM.java @@ -937,6 +937,10 @@ public class MockRM extends ResourceManager { rm.getResourceScheduler()).getApplicationAttempt(attemptId)); } + /** + * NOTE: nm.nodeHeartbeat is explicitly invoked, + * don't invoke it before calling launchAM + */ public static MockAM launchAM(RMApp app, MockRM rm, MockNM nm) throws Exception { RMAppAttempt attempt = waitForAttemptScheduled(app, rm); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestRM.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestRM.java index 69c62e7a664..ee6d51adb3f 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestRM.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestRM.java @@ -208,8 +208,6 @@ public class TestRM extends ParameterizedSchedulerTestBase { CapacityScheduler cs = (CapacityScheduler) rm.getResourceScheduler(); cs.getApplicationAttempt(attempt.getAppAttemptId()).getNewContainerId(); - // kick the scheduling - nm1.nodeHeartbeat(true); MockAM am = MockRM.launchAM(app, rm, nm1); // am container Id not equal to 1. Assert.assertTrue( diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestAMRestart.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestAMRestart.java index 76a17c38c56..bc09b37441b 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestAMRestart.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestAMRestart.java @@ -473,7 +473,6 @@ public class TestAMRestart { appState.getAttempt(am4.getApplicationAttemptId()) .getAMContainerExitStatus()); // launch next AM in nm2 - nm2.nodeHeartbeat(true); MockAM am5 = rm1.waitForNewAMToLaunchAndRegister(app1.getApplicationId(), 5, nm2); RMAppAttempt attempt5 = app1.getCurrentAppAttempt();