diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index 57080bb76db..eb7b44b4eba 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -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 diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmnode/RMNodeImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmnode/RMNodeImpl.java index dc53a5d0d76..0d337962ded 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmnode/RMNodeImpl.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmnode/RMNodeImpl.java @@ -491,6 +491,7 @@ public class RMNodeImpl implements RMNode, EventHandler { 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. diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestRMNodeTransitions.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestRMNodeTransitions.java index 3c453ebcd83..3bcde8d9256 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestRMNodeTransitions.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestRMNodeTransitions.java @@ -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()); + } }