YARN-1221. With Fair Scheduler, reserved MB reported in RM web UI increases indefinitely (Siqi Li via Sandy Ryza)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1527795 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sanford Ryza 2013-09-30 22:03:06 +00:00
parent 320c7519ed
commit 099c4eef3f
3 changed files with 41 additions and 6 deletions

View File

@ -83,6 +83,9 @@ Release 2.1.2 - UNRELEASED
YARN-1157. Fixed ResourceManager UI to behave correctly when apps like YARN-1157. Fixed ResourceManager UI to behave correctly when apps like
distributed-shell do not set tracking urls. (Xuan Gong via vinodkv) distributed-shell do not set tracking urls. (Xuan Gong via vinodkv)
YARN-1221. With Fair Scheduler, reserved MB reported in RM web UI increases
indefinitely (Siqi Li via Sandy Ryza)
Release 2.1.1-beta - 2013-09-23 Release 2.1.1-beta - 2013-09-23
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -192,10 +192,6 @@ public class AppSchedulable extends Schedulable {
RMContainer rmContainer = app.reserve(node, priority, null, RMContainer rmContainer = app.reserve(node, priority, null,
container); container);
node.reserveResource(app, priority, rmContainer); node.reserveResource(app, priority, rmContainer);
getMetrics().reserveResource(app.getUser(),
container.getResource());
scheduler.getRootQueueMetrics().reserveResource(app.getUser(),
container.getResource());
} }
else { else {
@ -216,8 +212,6 @@ public class AppSchedulable extends Schedulable {
node.unreserveResource(app); node.unreserveResource(app);
getMetrics().unreserveResource( getMetrics().unreserveResource(
app.getUser(), rmContainer.getContainer().getResource()); app.getUser(), rmContainer.getContainer().getResource());
scheduler.getRootQueueMetrics().unreserveResource(
app.getUser(), rmContainer.getContainer().getResource());
} }
/** /**

View File

@ -449,6 +449,44 @@ public class TestFairScheduler {
Assert.assertEquals(3, queueManager.getLeafQueues().size()); Assert.assertEquals(3, queueManager.getLeafQueues().size());
} }
@Test
public void testSchedulerRootQueueMetrics() throws InterruptedException {
// Add a node
RMNode node1 = MockNodes.newNodeInfo(1, Resources.createResource(1024));
NodeAddedSchedulerEvent nodeEvent1 = new NodeAddedSchedulerEvent(node1);
scheduler.handle(nodeEvent1);
// Queue 1 requests full capacity of node
createSchedulingRequest(1024, "queue1", "user1", 1);
scheduler.update();
NodeUpdateSchedulerEvent updateEvent = new NodeUpdateSchedulerEvent(node1);
scheduler.handle(updateEvent);
// Now queue 2 requests likewise
createSchedulingRequest(1024, "queue2", "user1", 1);
scheduler.update();
scheduler.handle(updateEvent);
// Make sure reserved memory gets updated correctly
assertEquals(1024, scheduler.rootMetrics.getReservedMB());
// Now another node checks in with capacity
RMNode node2 = MockNodes.newNodeInfo(1, Resources.createResource(1024));
NodeAddedSchedulerEvent nodeEvent2 = new NodeAddedSchedulerEvent(node2);
NodeUpdateSchedulerEvent updateEvent2 = new NodeUpdateSchedulerEvent(node2);
scheduler.handle(nodeEvent2);
scheduler.handle(updateEvent2);
// The old reservation should still be there...
assertEquals(1024, scheduler.rootMetrics.getReservedMB());
// ... but it should disappear when we update the first node.
scheduler.handle(updateEvent);
assertEquals(0, scheduler.rootMetrics.getReservedMB());
}
@Test (timeout = 5000) @Test (timeout = 5000)
public void testSimpleContainerAllocation() { public void testSimpleContainerAllocation() {
// Add a node // Add a node