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/trunk@1569443 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
62b023c241
commit
e60f5b6c40
@ -289,6 +289,9 @@ Release 2.4.0 - UNRELEASED
|
|||||||
instead rely on the http policy framework. And also fix some bugs related
|
instead rely on the http policy framework. And also fix some bugs related
|
||||||
to https handling in YARN web-apps. (Haohui Mai via vinodkv)
|
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
|
Release 2.3.1 - UNRELEASED
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
@ -1366,24 +1366,26 @@ public synchronized String moveApplication(ApplicationId appId,
|
|||||||
throw new YarnException("App to be moved " + appId + " not found.");
|
throw new YarnException("App to be moved " + appId + " not found.");
|
||||||
}
|
}
|
||||||
FSSchedulerApp attempt = (FSSchedulerApp) app.getCurrentAppAttempt();
|
FSSchedulerApp attempt = (FSSchedulerApp) app.getCurrentAppAttempt();
|
||||||
|
// To serialize with FairScheduler#allocate, synchronize on app attempt
|
||||||
FSLeafQueue oldQueue = (FSLeafQueue) app.getQueue();
|
synchronized (attempt) {
|
||||||
FSLeafQueue targetQueue = queueMgr.getLeafQueue(queueName, false);
|
FSLeafQueue oldQueue = (FSLeafQueue) app.getQueue();
|
||||||
if (targetQueue == null) {
|
FSLeafQueue targetQueue = queueMgr.getLeafQueue(queueName, false);
|
||||||
throw new YarnException("Target queue " + queueName
|
if (targetQueue == null) {
|
||||||
+ " not found or is not a leaf queue.");
|
throw new YarnException("Target queue " + queueName
|
||||||
|
+ " not found or is not a leaf queue.");
|
||||||
|
}
|
||||||
|
if (targetQueue == oldQueue) {
|
||||||
|
return oldQueue.getQueueName();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (oldQueue.getRunnableAppSchedulables().contains(
|
||||||
|
attempt.getAppSchedulable())) {
|
||||||
|
verifyMoveDoesNotViolateConstraints(attempt, oldQueue, targetQueue);
|
||||||
|
}
|
||||||
|
|
||||||
|
executeMove(app, attempt, oldQueue, targetQueue);
|
||||||
|
return targetQueue.getQueueName();
|
||||||
}
|
}
|
||||||
if (targetQueue == oldQueue) {
|
|
||||||
return oldQueue.getQueueName();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (oldQueue.getRunnableAppSchedulables().contains(
|
|
||||||
attempt.getAppSchedulable())) {
|
|
||||||
verifyMoveDoesNotViolateConstraints(attempt, oldQueue, targetQueue);
|
|
||||||
}
|
|
||||||
|
|
||||||
executeMove(app, attempt, oldQueue, targetQueue);
|
|
||||||
return targetQueue.getQueueName();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void verifyMoveDoesNotViolateConstraints(FSSchedulerApp app,
|
private void verifyMoveDoesNotViolateConstraints(FSSchedulerApp app,
|
||||||
@ -1420,8 +1422,8 @@ private void verifyMoveDoesNotViolateConstraints(FSSchedulerApp app,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper for moveApplication, which is synchronized, so all operations will
|
* Helper for moveApplication, which has appropriate synchronization, so all
|
||||||
* be atomic.
|
* operations will be atomic.
|
||||||
*/
|
*/
|
||||||
private void executeMove(SchedulerApplication app, FSSchedulerApp attempt,
|
private void executeMove(SchedulerApplication app, FSSchedulerApp attempt,
|
||||||
FSLeafQueue oldQueue, FSLeafQueue newQueue) {
|
FSLeafQueue oldQueue, FSLeafQueue newQueue) {
|
||||||
|
Loading…
Reference in New Issue
Block a user