YARN-1981. Nodemanager version is not updated when a node reconnects (Jason Lowe via jeagles)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1594358 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jonathan Turner Eagles 2014-05-13 20:03:58 +00:00
parent 2f87e77cb7
commit 1c48142807
3 changed files with 19 additions and 1 deletions

View File

@ -79,6 +79,9 @@ Release 2.5.0 - UNRELEASED
YARN-1751. Improve MiniYarnCluster for log aggregation testing (Ming Ma
via jlowe)
YARN-1981. Nodemanager version is not updated when a node reconnects (Jason
Lowe via jeagles)
OPTIMIZATIONS
BUG FIXES

View File

@ -491,6 +491,7 @@ public class RMNodeImpl implements RMNode, EventHandler<RMNodeEvent> {
new NodeRemovedSchedulerEvent(rmNode));
RMNode newNode = ((RMNodeReconnectEvent)event).getReconnectedNode();
rmNode.nodeManagerVersion = newNode.getNodeManagerVersion();
if (rmNode.getTotalCapability().equals(newNode.getTotalCapability())
&& rmNode.getHttpPort() == newNode.getHttpPort()) {
// Reset heartbeat ID since node just restarted.

View File

@ -455,11 +455,15 @@ public class TestRMNodeTransitions {
}
private RMNodeImpl getRunningNode() {
return getRunningNode(null);
}
private RMNodeImpl getRunningNode(String nmVersion) {
NodeId nodeId = BuilderUtils.newNodeId("localhost", 0);
Resource capability = Resource.newInstance(4096, 4);
RMNodeImpl node = new RMNodeImpl(nodeId, rmContext,null, 0, 0,
null, ResourceOption.newInstance(capability,
RMNode.OVER_COMMIT_TIMEOUT_MILLIS_DEFAULT), null);
RMNode.OVER_COMMIT_TIMEOUT_MILLIS_DEFAULT), nmVersion);
node.handle(new RMNodeEvent(node.getNodeID(), RMNodeEventType.STARTED));
Assert.assertEquals(NodeState.RUNNING, node.getState());
return node;
@ -530,4 +534,14 @@ public class TestRMNodeTransitions {
nodesListManagerEvent.getType());
}
@Test
public void testReconnnectUpdate() {
final String nmVersion1 = "nm version 1";
final String nmVersion2 = "nm version 2";
RMNodeImpl node = getRunningNode(nmVersion1);
Assert.assertEquals(nmVersion1, node.getNodeManagerVersion());
RMNodeImpl reconnectingNode = getRunningNode(nmVersion2);
node.handle(new RMNodeReconnectEvent(node.getNodeID(), reconnectingNode));
Assert.assertEquals(nmVersion2, node.getNodeManagerVersion());
}
}