YARN-9645. Fix Invalid event FINISHED_CONTAINERS_PULLED_BY_AM at NEW on NM restart. Contributed by Bilwa S T.
(cherry picked from commit 7a93be0f6002ebb376c30f25a7d403e853c44280)
This commit is contained in:
parent
7c9cfc0996
commit
4866735cde
@ -205,6 +205,9 @@ RMNodeEventType.STARTED, new AddNodeTransition())
|
|||||||
.addTransition(NodeState.NEW, NodeState.DECOMMISSIONED,
|
.addTransition(NodeState.NEW, NodeState.DECOMMISSIONED,
|
||||||
RMNodeEventType.DECOMMISSION,
|
RMNodeEventType.DECOMMISSION,
|
||||||
new DeactivateNodeTransition(NodeState.DECOMMISSIONED))
|
new DeactivateNodeTransition(NodeState.DECOMMISSIONED))
|
||||||
|
.addTransition(NodeState.NEW, NodeState.NEW,
|
||||||
|
RMNodeEventType.FINISHED_CONTAINERS_PULLED_BY_AM,
|
||||||
|
new AddContainersToBeRemovedFromNMTransition())
|
||||||
|
|
||||||
//Transitions from RUNNING state
|
//Transitions from RUNNING state
|
||||||
.addTransition(NodeState.RUNNING,
|
.addTransition(NodeState.RUNNING,
|
||||||
@ -1557,4 +1560,9 @@ public Set<NodeAttribute> getAllNodeAttributes() {
|
|||||||
attrMgr.getAttributesForNode(hostName);
|
attrMgr.getAttributesForNode(hostName);
|
||||||
return nodeattrs.keySet();
|
return nodeattrs.keySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@VisibleForTesting
|
||||||
|
public Set<ContainerId> getContainersToBeRemovedFromNM() {
|
||||||
|
return containersToBeRemovedFromNM;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -195,6 +195,13 @@ private List<ApplicationId> getAppIdList() {
|
|||||||
return appIdList;
|
return appIdList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private List<ContainerId> getContainerIdList() {
|
||||||
|
List<ContainerId> containerIdList = new ArrayList<ContainerId>();
|
||||||
|
containerIdList.add(BuilderUtils.newContainerId(BuilderUtils
|
||||||
|
.newApplicationAttemptId(BuilderUtils.newApplicationId(0, 0), 0), 0));
|
||||||
|
return containerIdList;
|
||||||
|
}
|
||||||
|
|
||||||
private RMNodeStatusEvent getMockRMNodeStatusEventWithoutRunningApps() {
|
private RMNodeStatusEvent getMockRMNodeStatusEventWithoutRunningApps() {
|
||||||
NodeHealthStatus healthStatus = mock(NodeHealthStatus.class);
|
NodeHealthStatus healthStatus = mock(NodeHealthStatus.class);
|
||||||
Boolean yes = new Boolean(true);
|
Boolean yes = new Boolean(true);
|
||||||
@ -1104,4 +1111,15 @@ public void testForHandlingDuplicatedCompltedContainers() {
|
|||||||
Assert.assertEquals(1, hbrsp.getContainersToBeRemovedFromNM().size());
|
Assert.assertEquals(1, hbrsp.getContainersToBeRemovedFromNM().size());
|
||||||
Assert.assertEquals(0, node.getCompletedContainers().size());
|
Assert.assertEquals(0, node.getCompletedContainers().size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testFinishedContainersPulledByAMOnNewNode() {
|
||||||
|
RMNodeImpl rmNode = getNewNode();
|
||||||
|
NodeId nodeId = BuilderUtils.newNodeId("localhost", 0);
|
||||||
|
|
||||||
|
rmNode.handle(new RMNodeFinishedContainersPulledByAMEvent(nodeId,
|
||||||
|
getContainerIdList()));
|
||||||
|
Assert.assertEquals(1, rmNode.getContainersToBeRemovedFromNM().size());
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user