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/trunk@1424945 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Thomas White 2012-12-21 15:10:24 +00:00
parent 557b022406
commit ee007d3f38
3 changed files with 32 additions and 1 deletions

View File

@ -140,6 +140,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
INCOMPATIBLE CHANGES

View File

@ -777,7 +777,8 @@ private synchronized void nodeUpdate(RMNode nm,
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 void testPreemptionDecision() throws Exception {
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());
}
}