Merge -r 1424944:1424945 from trunk to branch-2. Fixes: YARN-271. Fair scheduler hits IllegalStateException trying to reserve different apps on same node. Contributed by Sandy Ryza.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1424946 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Thomas White 2012-12-21 15:11:43 +00:00
parent 8c293a7ff1
commit 0e9379a9f1
3 changed files with 32 additions and 1 deletions

View File

@ -123,6 +123,9 @@ Release 2.0.3-alpha - Unreleased
YARN-264. y.s.rm.DelegationTokenRenewer attempts to renew token even
after removing an app. (kkambatl via tucu)
YARN-271. Fair scheduler hits IllegalStateException trying to reserve
different apps on same node. (Sandy Ryza via tomwhite)
Release 2.0.2-alpha - 2012-09-07
YARN-9. Rename YARN_HOME to HADOOP_YARN_HOME. (vinodkv via acmurthy)

View File

@ -777,7 +777,8 @@ public class FairScheduler implements ResourceScheduler {
boolean assignedContainer = false;
for (FSLeafQueue sched : scheds) {
Resource assigned = sched.assignContainer(node, false);
if (Resources.greaterThan(assigned, Resources.none())) {
if (Resources.greaterThan(assigned, Resources.none()) ||
node.getReservedContainer() != null) {
eventLog.log("ASSIGN", nm.getHostName(), assigned);
assignedContainers++;
assignedContainer = true;

View File

@ -1098,4 +1098,31 @@ public class TestFairScheduler {
assertTrue(Resources.equals(
Resources.createResource(1536), scheduler.resToPreempt(schedD, clock.getTime())));
}
@Test
public void testMultipleContainersWaitingForReservation() {
// Add a node
RMNode node1 = MockNodes.newNodeInfo(1, Resources.createResource(1024));
NodeAddedSchedulerEvent nodeEvent1 = new NodeAddedSchedulerEvent(node1);
scheduler.handle(nodeEvent1);
// Request full capacity of node
createSchedulingRequest(1024, "queue1", "user1", 1);
scheduler.update();
NodeUpdateSchedulerEvent updateEvent = new NodeUpdateSchedulerEvent(node1,
new ArrayList<ContainerStatus>(), new ArrayList<ContainerStatus>());
scheduler.handle(updateEvent);
ApplicationAttemptId attId1 = createSchedulingRequest(1024, "queue2", "user2", 1);
ApplicationAttemptId attId2 = createSchedulingRequest(1024, "queue3", "user3", 1);
scheduler.update();
scheduler.handle(updateEvent);
// One container should get reservation and the other should get nothing
assertEquals(1024,
scheduler.applications.get(attId1).getCurrentReservation().getMemory());
assertEquals(0,
scheduler.applications.get(attId2).getCurrentReservation().getMemory());
}
}