YARN-1721. When moving app between queues in Fair Scheduler, grab lock on FSSchedulerApp (Sandy Ryza)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1569445 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sanford Ryza 2014-02-18 17:52:30 +00:00
parent 5c26966bb7
commit 90cbdfaf9d
2 changed files with 24 additions and 19 deletions

View File

@ -274,6 +274,9 @@ Release 2.4.0 - UNRELEASED
instead rely on the http policy framework. And also fix some bugs related
to https handling in YARN web-apps. (Haohui Mai via vinodkv)
YARN-1721. When moving app between queues in Fair Scheduler, grab lock on
FSSchedulerApp (Sandy Ryza)
Release 2.3.1 - UNRELEASED
INCOMPATIBLE CHANGES

View File

@ -1366,7 +1366,8 @@ public class FairScheduler extends AbstractYarnScheduler {
throw new YarnException("App to be moved " + appId + " not found.");
}
FSSchedulerApp attempt = (FSSchedulerApp) app.getCurrentAppAttempt();
// To serialize with FairScheduler#allocate, synchronize on app attempt
synchronized (attempt) {
FSLeafQueue oldQueue = (FSLeafQueue) app.getQueue();
FSLeafQueue targetQueue = queueMgr.getLeafQueue(queueName, false);
if (targetQueue == null) {
@ -1385,6 +1386,7 @@ public class FairScheduler extends AbstractYarnScheduler {
executeMove(app, attempt, oldQueue, targetQueue);
return targetQueue.getQueueName();
}
}
private void verifyMoveDoesNotViolateConstraints(FSSchedulerApp app,
FSLeafQueue oldQueue, FSLeafQueue targetQueue) throws YarnException {
@ -1420,8 +1422,8 @@ public class FairScheduler extends AbstractYarnScheduler {
}
/**
* Helper for moveApplication, which is synchronized, so all operations will
* be atomic.
* Helper for moveApplication, which has appropriate synchronization, so all
* operations will be atomic.
*/
private void executeMove(SchedulerApplication app, FSSchedulerApp attempt,
FSLeafQueue oldQueue, FSLeafQueue newQueue) {