From a207aa9930e7ee4f10228e2db4b4e733794eb8ea Mon Sep 17 00:00:00 2001 From: Sunil G Date: Thu, 23 Feb 2017 14:19:07 +0530 Subject: [PATCH] YARN-6211. Synchronization improvement for moveApplicationAcrossQueues and updateApplicationPriority. Contributed by Bibin A Chundatt. --- .../hadoop/yarn/server/resourcemanager/ClientRMService.java | 6 ++++-- .../hadoop/yarn/server/resourcemanager/RMAppManager.java | 5 ++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ClientRMService.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ClientRMService.java index 0c87ede777..48bccfb16a 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ClientRMService.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ClientRMService.java @@ -1228,7 +1228,8 @@ public MoveApplicationAcrossQueuesResponse moveApplicationAcrossQueues( } try { - this.rmAppManager.moveApplicationAcrossQueue(applicationId, + this.rmAppManager.moveApplicationAcrossQueue( + application.getApplicationId(), request.getTargetQueue()); } catch (YarnException ex) { RMAuditLogger.logFailure(callerUGI.getShortUserName(), @@ -1662,7 +1663,8 @@ public UpdateApplicationPriorityResponse updateApplicationPriority( } try { - rmAppManager.updateApplicationPriority(callerUGI, applicationId, + rmAppManager.updateApplicationPriority(callerUGI, + application.getApplicationId(), newAppPriority); } catch (YarnException ex) { RMAuditLogger.logFailure(callerUGI.getShortUserName(), 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 cc796e3f64..e211867f85 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 @@ -53,7 +53,6 @@ import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppImpl; import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppMetrics; import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppRecoverEvent; -import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppState; import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttempt; import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttemptImpl; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerUtils; @@ -612,7 +611,7 @@ public void updateApplicationPriority(UserGroupInformation callerUGI, RMApp app = this.rmContext.getRMApps().get(applicationId); synchronized (applicationId) { - if (app.isAppInCompletedStates()) { + if (app == null || app.isAppInCompletedStates()) { return; } @@ -658,7 +657,7 @@ public void moveApplicationAcrossQueue(ApplicationId applicationId, String targe // 2. Update this information to state-store // 3. Perform real move operation and update in-memory data structures. synchronized (applicationId) { - if (app.isAppInCompletedStates()) { + if (app == null || app.isAppInCompletedStates()) { return; }