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

(cherry picked from commit a207aa9930)
This commit is contained in:
Sunil G 2017-02-23 14:19:07 +05:30
parent 37edbd35f1
commit 801357726d
2 changed files with 6 additions and 5 deletions

View File

@ -1189,7 +1189,8 @@ public class ClientRMService extends AbstractService implements
}
try {
this.rmAppManager.moveApplicationAcrossQueue(applicationId,
this.rmAppManager.moveApplicationAcrossQueue(
application.getApplicationId(),
request.getTargetQueue());
} catch (YarnException ex) {
RMAuditLogger.logFailure(callerUGI.getShortUserName(),
@ -1612,7 +1613,8 @@ public class ClientRMService extends AbstractService implements
}
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.RMAppEventType;
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;
@ -604,7 +603,7 @@ public class RMAppManager implements EventHandler<RMAppManagerEvent>,
RMApp app = this.rmContext.getRMApps().get(applicationId);
synchronized (applicationId) {
if (app.isAppInCompletedStates()) {
if (app == null || app.isAppInCompletedStates()) {
return;
}
@ -650,7 +649,7 @@ public class RMAppManager implements EventHandler<RMAppManagerEvent>,
// 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;
}