YARN-6211. Synchronization improvement for moveApplicationAcrossQueues and updateApplicationPriority. Contributed by Bibin A Chundatt.

This commit is contained in:
Sunil G 2017-02-23 14:19:07 +05:30
parent 13d4bcfe35
commit a207aa9930
2 changed files with 6 additions and 5 deletions

View File

@ -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(),

View File

@ -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;
}