diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index 57080bb76d..eb7b44b4eb 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 dc53a5d0d7..0d337962de 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 void transition(RMNodeImpl rmNode, RMNodeEvent event) { 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 3c453ebcd8..3bcde8d925 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 void testUpdateHeartbeatResponseForCleanup() { } 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 void testReconnect() { 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()); + } }