From 7decba83ef541b1f89745ad040c6137d24b187b0 Mon Sep 17 00:00:00 2001 From: Xuan Date: Mon, 7 Dec 2015 12:24:55 -0800 Subject: [PATCH] YARN-4392. ApplicationCreatedEvent event time resets after RM restart/failover. Contributed by Naganarasimha G R and Xuan Gong (cherry picked from commit 4546c7582b6762c18ba150d80a8976eb51a8290c) --- hadoop-yarn-project/CHANGES.txt | 3 +++ .../server/resourcemanager/RMAppManager.java | 1 - .../resourcemanager/rmapp/RMAppImpl.java | 14 ++++++++--- .../server/resourcemanager/TestRMRestart.java | 25 ++++++++++++++++--- .../rmapp/TestRMAppTransitions.java | 4 +-- 5 files changed, 37 insertions(+), 10 deletions(-) diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index 1851776a70a..381ab7f7b89 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -1051,6 +1051,9 @@ Release 2.8.0 - UNRELEASED YARN-4408. Fix issue that NodeManager reports negative running containers. (Robert Kanter via junping_du) + YARN-4392. ApplicationCreatedEvent event time resets after RM restart/failover. + (Naganarasimha G R and Xuan Gong via xgong) + Release 2.7.3 - UNRELEASED 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/RMAppManager.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/RMAppManager.java index c9ea1b87283..711a7a7c0ab 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/RMAppManager.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/RMAppManager.java @@ -26,7 +26,6 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.io.DataInputByteBuffer; -import org.apache.hadoop.ipc.CallerContext; import org.apache.hadoop.security.Credentials; import org.apache.hadoop.security.UserGroupInformation; import org.apache.hadoop.util.StringUtils; 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/RMAppImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/RMAppImpl.java index 92208496de3..8baddeed780 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/RMAppImpl.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/RMAppImpl.java @@ -444,9 +444,6 @@ public class RMAppImpl implements RMApp, Recoverable { this.callerContext = CallerContext.getCurrent(); - rmContext.getRMApplicationHistoryWriter().applicationStarted(this); - rmContext.getSystemMetricsPublisher().appCreated(this, startTime); - long localLogAggregationStatusTimeout = conf.getLong(YarnConfiguration.LOG_AGGREGATION_STATUS_TIME_OUT_MS, YarnConfiguration.DEFAULT_LOG_AGGREGATION_STATUS_TIME_OUT_MS); @@ -813,6 +810,9 @@ public class RMAppImpl implements RMApp, Recoverable { this.startTime = appState.getStartTime(); this.callerContext = appState.getCallerContext(); + // send the ATS create Event + sendATSCreateEvent(this, this.startTime); + for(int i=0; i NEW_SAVING event RMAppEventType.START RMAppEvent event = new RMAppEvent(application.getApplicationId(), RMAppEventType.START);