YARN-4005. Completed container whose app is finished is possibly not removed from NMStateStore. Contributed by Jun Gong
(cherry picked from commit 38aed1a94e
)
This commit is contained in:
parent
073cb16d81
commit
4a5fdb7c23
|
@ -711,6 +711,9 @@ Release 2.8.0 - UNRELEASED
|
||||||
YARN-3992. TestApplicationPriority.testApplicationPriorityAllocation fails
|
YARN-3992. TestApplicationPriority.testApplicationPriorityAllocation fails
|
||||||
intermittently. (Contributed by Sunil G)
|
intermittently. (Contributed by Sunil G)
|
||||||
|
|
||||||
|
YARN-4005. Completed container whose app is finished is possibly not
|
||||||
|
removed from NMStateStore. (Jun Gong via jianhe)
|
||||||
|
|
||||||
Release 2.7.2 - UNRELEASED
|
Release 2.7.2 - UNRELEASED
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -474,12 +474,12 @@ public class NodeStatusUpdaterImpl extends AbstractService implements
|
||||||
} else {
|
} else {
|
||||||
if (!isContainerRecentlyStopped(containerId)) {
|
if (!isContainerRecentlyStopped(containerId)) {
|
||||||
pendingCompletedContainers.put(containerId, containerStatus);
|
pendingCompletedContainers.put(containerId, containerStatus);
|
||||||
// Adding to finished containers cache. Cache will keep it around at
|
|
||||||
// least for #durationToTrackStoppedContainers duration. In the
|
|
||||||
// subsequent call to stop container it will get removed from cache.
|
|
||||||
addCompletedContainer(containerId);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Adding to finished containers cache. Cache will keep it around at
|
||||||
|
// least for #durationToTrackStoppedContainers duration. In the
|
||||||
|
// subsequent call to stop container it will get removed from cache.
|
||||||
|
addCompletedContainer(containerId);
|
||||||
} else {
|
} else {
|
||||||
containerStatuses.add(containerStatus);
|
containerStatuses.add(containerStatus);
|
||||||
}
|
}
|
||||||
|
|
|
@ -994,6 +994,40 @@ public class TestNodeStatusUpdater {
|
||||||
Assert.assertTrue(containerIdSet.contains(runningContainerId));
|
Assert.assertTrue(containerIdSet.contains(runningContainerId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test(timeout = 10000)
|
||||||
|
public void testCompletedContainersIsRecentlyStopped() throws Exception {
|
||||||
|
NodeManager nm = new NodeManager();
|
||||||
|
nm.init(conf);
|
||||||
|
NodeStatusUpdaterImpl nodeStatusUpdater =
|
||||||
|
(NodeStatusUpdaterImpl) nm.getNodeStatusUpdater();
|
||||||
|
ApplicationId appId = ApplicationId.newInstance(0, 0);
|
||||||
|
Application completedApp = mock(Application.class);
|
||||||
|
when(completedApp.getApplicationState()).thenReturn(
|
||||||
|
ApplicationState.FINISHED);
|
||||||
|
ApplicationAttemptId appAttemptId =
|
||||||
|
ApplicationAttemptId.newInstance(appId, 0);
|
||||||
|
ContainerId containerId = ContainerId.newContainerId(appAttemptId, 1);
|
||||||
|
Token containerToken =
|
||||||
|
BuilderUtils.newContainerToken(containerId, "host", 1234, "user",
|
||||||
|
BuilderUtils.newResource(1024, 1), 0, 123,
|
||||||
|
"password".getBytes(), 0);
|
||||||
|
Container completedContainer = new ContainerImpl(conf, null,
|
||||||
|
null, null, null, null,
|
||||||
|
BuilderUtils.newContainerTokenIdentifier(containerToken)) {
|
||||||
|
@Override
|
||||||
|
public ContainerState getCurrentState() {
|
||||||
|
return ContainerState.COMPLETE;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
nm.getNMContext().getApplications().putIfAbsent(appId, completedApp);
|
||||||
|
nm.getNMContext().getContainers().put(containerId, completedContainer);
|
||||||
|
|
||||||
|
Assert.assertEquals(1, nodeStatusUpdater.getContainerStatuses().size());
|
||||||
|
Assert.assertTrue(nodeStatusUpdater.isContainerRecentlyStopped(
|
||||||
|
containerId));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCleanedupApplicationContainerCleanup() throws IOException {
|
public void testCleanedupApplicationContainerCleanup() throws IOException {
|
||||||
NodeManager nm = new NodeManager();
|
NodeManager nm = new NodeManager();
|
||||||
|
|
Loading…
Reference in New Issue