diff --git 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 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 1be1727..0bd6d8e 100644 --- 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 +++ 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 @@ -857,6 +857,12 @@ public void transferStateFromPreviousAttempt(RMAppAttempt attempt) { attempt.getFinishedContainersSentToAMReference(); } + public void shareStateWithCurrentAttempt(RMAppAttempt attempt) { + this.justFinishedContainers = attempt.getJustFinishedContainersReference(); + this.finishedContainersSentToAM = + attempt.getFinishedContainersSentToAMReference(); + } + private void recoverAppAttemptCredentials(Credentials appAttemptTokens, RMAppAttemptState state) { if (appAttemptTokens == null || state == RMAppAttemptState.FAILED @@ -1051,6 +1057,13 @@ public RMAppAttemptState transition(RMAppAttemptImpl appAttempt, appAttempt.progress = 1.0f; RMApp rmApp =appAttempt.rmContext.getRMApps().get( appAttempt.getAppAttemptId().getApplicationId()); + + if (appAttempt.submissionContext + .getKeepContainersAcrossApplicationAttempts() + && !appAttempt.submissionContext.getUnmanagedAM() + && rmApp.getCurrentAppAttempt() != appAttempt) { + appAttempt.shareStateWithCurrentAttempt(rmApp.getCurrentAppAttempt()); + } // We will replay the final attempt only if last attempt is in final // state but application is not in final state. if (rmApp.getCurrentAppAttempt() == appAttempt