YARN-1724. Race condition in Fair Scheduler when continuous scheduling is turned on (Sandy Ryza)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1569451 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sanford Ryza 2014-02-18 18:07:59 +00:00
parent 90cbdfaf9d
commit ebb9cb3ee5
2 changed files with 10 additions and 1 deletions

View File

@ -277,6 +277,9 @@ Release 2.4.0 - UNRELEASED
YARN-1721. When moving app between queues in Fair Scheduler, grab lock on YARN-1721. When moving app between queues in Fair Scheduler, grab lock on
FSSchedulerApp (Sandy Ryza) FSSchedulerApp (Sandy Ryza)
YARN-1724. Race condition in Fair Scheduler when continuous scheduling is
turned on (Sandy Ryza)
Release 2.3.1 - UNRELEASED Release 2.3.1 - UNRELEASED
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -989,7 +989,13 @@ public class FairScheduler extends AbstractYarnScheduler {
private void continuousScheduling() { private void continuousScheduling() {
while (true) { while (true) {
List<NodeId> nodeIdList = new ArrayList<NodeId>(nodes.keySet()); List<NodeId> nodeIdList = new ArrayList<NodeId>(nodes.keySet());
// Sort the nodes by space available on them, so that we offer
// containers on emptier nodes first, facilitating an even spread. This
// requires holding the scheduler lock, so that the space available on a
// node doesn't change during the sort.
synchronized (this) {
Collections.sort(nodeIdList, nodeAvailableResourceComparator); Collections.sort(nodeIdList, nodeAvailableResourceComparator);
}
// iterate all nodes // iterate all nodes
for (NodeId nodeId : nodeIdList) { for (NodeId nodeId : nodeIdList) {