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/branches/branch-2@1594361 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jonathan Turner Eagles 2014-05-13 20:08:18 +00:00
parent 155e816bc2
commit a943350eb9
3 changed files with 19 additions and 1 deletions

View File

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

View File

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

View File

@ -455,11 +455,15 @@ public class TestRMNodeTransitions {
} }
private RMNodeImpl getRunningNode() { private RMNodeImpl getRunningNode() {
return getRunningNode(null);
}
private RMNodeImpl getRunningNode(String nmVersion) {
NodeId nodeId = BuilderUtils.newNodeId("localhost", 0); NodeId nodeId = BuilderUtils.newNodeId("localhost", 0);
Resource capability = Resource.newInstance(4096, 4); Resource capability = Resource.newInstance(4096, 4);
RMNodeImpl node = new RMNodeImpl(nodeId, rmContext,null, 0, 0, RMNodeImpl node = new RMNodeImpl(nodeId, rmContext,null, 0, 0,
null, ResourceOption.newInstance(capability, 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)); node.handle(new RMNodeEvent(node.getNodeID(), RMNodeEventType.STARTED));
Assert.assertEquals(NodeState.RUNNING, node.getState()); Assert.assertEquals(NodeState.RUNNING, node.getState());
return node; return node;
@ -530,4 +534,14 @@ public class TestRMNodeTransitions {
nodesListManagerEvent.getType()); 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());
}
} }