diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index ba5490c5809..187977b2646 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -549,6 +549,9 @@ Release 2.7.0 - UNRELEASED YARN-3074. Nodemanager dies when localizer runner tries to write to a full disk (Varun Saxena via jlowe) + YARN-3151. On Failover tracking url wrong in application cli for + KILLED application (Rohith via xgong) + Release 2.6.0 - 2014-11-18 INCOMPATIBLE CHANGES diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/RMAppAttemptImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/RMAppAttemptImpl.java index e1218adbd7b..8d1270a99ab 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/RMAppAttemptImpl.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/RMAppAttemptImpl.java @@ -552,11 +552,18 @@ public class RMAppAttemptImpl implements RMAppAttempt, Recoverable { } } - private void setTrackingUrlToRMAppPage() { + private void setTrackingUrlToRMAppPage(RMAppAttemptState stateToBeStored) { originalTrackingUrl = pjoin( WebAppUtils.getResolvedRMWebAppURLWithScheme(conf), "cluster", "app", getAppAttemptId().getApplicationId()); - proxiedTrackingUrl = originalTrackingUrl; + switch (stateToBeStored) { + case KILLED: + case FAILED: + proxiedTrackingUrl = originalTrackingUrl; + break; + default: + break; + } } private void invalidateAMHostAndPort() { @@ -1083,7 +1090,10 @@ public class RMAppAttemptImpl implements RMAppAttempt, Recoverable { // These fields can be visible from outside only after they are saved in // StateStore String diags = null; - String finalTrackingUrl = null; + + // don't leave the tracking URL pointing to a non-existent AM + setTrackingUrlToRMAppPage(stateToBeStored); + String finalTrackingUrl = getOriginalTrackingUrl(); FinalApplicationStatus finalStatus = null; int exitStatus = ContainerExitStatus.INVALID; switch (event.getType()) { @@ -1099,6 +1109,7 @@ public class RMAppAttemptImpl implements RMAppAttempt, Recoverable { RMAppAttemptUnregistrationEvent unregisterEvent = (RMAppAttemptUnregistrationEvent) event; diags = unregisterEvent.getDiagnostics(); + // reset finalTrackingUrl to url sent by am finalTrackingUrl = sanitizeTrackingUrl(unregisterEvent.getFinalTrackingUrl()); finalStatus = unregisterEvent.getFinalApplicationStatus(); break; @@ -1202,8 +1213,6 @@ public class RMAppAttemptImpl implements RMAppAttempt, Recoverable { break; case KILLED: { - // don't leave the tracking URL pointing to a non-existent AM - appAttempt.setTrackingUrlToRMAppPage(); appAttempt.invalidateAMHostAndPort(); appEvent = new RMAppFailedAttemptEvent(applicationId, @@ -1213,8 +1222,6 @@ public class RMAppAttemptImpl implements RMAppAttempt, Recoverable { break; case FAILED: { - // don't leave the tracking URL pointing to a non-existent AM - appAttempt.setTrackingUrlToRMAppPage(); appAttempt.invalidateAMHostAndPort(); if (appAttempt.submissionContext 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 4caf7e38330..a0b67f6be95 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 @@ -769,6 +769,8 @@ public class TestRMRestart extends ParameterizedSchedulerTestBase { Assert.assertEquals(RMAppState.KILLED, appState.getState()); Assert.assertEquals(RMAppAttemptState.KILLED, appState.getAttempt(am0.getApplicationAttemptId()).getState()); + String trackingUrl = app0.getCurrentAppAttempt().getOriginalTrackingUrl(); + Assert.assertNotNull(trackingUrl); // restart rm MockRM rm2 = createMockRM(conf, memStore); @@ -782,6 +784,8 @@ public class TestRMRestart extends ParameterizedSchedulerTestBase { ApplicationReport appReport = verifyAppReportAfterRMRestart(app0, rm2); Assert.assertEquals(app0.getDiagnostics().toString(), appReport.getDiagnostics()); + Assert.assertEquals(trackingUrl, loadedApp0.getCurrentAppAttempt() + .getOriginalTrackingUrl()); } @Test (timeout = 60000) diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/TestRMAppAttemptTransitions.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/TestRMAppAttemptTransitions.java index fee40e7761a..9f5ae79127e 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/TestRMAppAttemptTransitions.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/TestRMAppAttemptTransitions.java @@ -1491,7 +1491,7 @@ public class TestRMAppAttemptTransitions { diagnostics.contains("exitCode: " + exitCode)); if (shouldCheckURL) { assertTrue("Diagnostic information does not contain application proxy URL", - diagnostics.contains(applicationAttempt.getWebProxyBase())); + diagnostics.contains(applicationAttempt.getTrackingUrl())); } }