Skip to content

Commit 81da221

Browse files
committed
YARN-10388. RMNode updatedCapability flag not set while RecommissionNodeTransition. Contributed by Pranjal Protim Borah
1 parent a2610e2 commit 81da221

File tree

3 files changed

+9
-0
lines changed
  • hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server

3 files changed

+9
-0
lines changed

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/NodeStatusUpdaterImpl.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1407,6 +1407,9 @@ public void run() {
14071407
if (newResource != null) {
14081408
updateNMResource(newResource);
14091409
LOG.debug("Node's resource is updated to {}", newResource);
1410+
if (!totalResource.equals(newResource)) {
1411+
LOG.info("Node's resource is updated to {}", newResource);
1412+
}
14101413
}
14111414
if (timelineServiceV2Enabled) {
14121415
updateTimelineCollectorData(response);

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmnode/RMNodeImpl.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1234,6 +1234,7 @@ public void transition(RMNodeImpl rmNode, RMNodeEvent event) {
12341234
if (rmNode.originalTotalCapability != null) {
12351235
rmNode.totalCapability = rmNode.originalTotalCapability;
12361236
rmNode.originalTotalCapability = null;
1237+
rmNode.updatedCapability = true;
12371238
}
12381239
LOG.info("Node " + rmNode.nodeId + " in DECOMMISSIONING is " +
12391240
"recommissioned back to RUNNING.");

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestRMNodeTransitions.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
import static org.apache.hadoop.yarn.server.resourcemanager.MockNM.createMockNodeStatus;
2121
import static org.junit.Assert.assertEquals;
22+
import static org.junit.Assert.assertFalse;
23+
import static org.junit.Assert.assertTrue;
2224
import static org.mockito.ArgumentMatchers.any;
2325
import static org.mockito.Mockito.doAnswer;
2426
import static org.mockito.Mockito.doReturn;
@@ -1062,10 +1064,13 @@ public void testResourceUpdateOnRecommissioningNode() {
10621064
Resource oldCapacity = node.getTotalCapability();
10631065
assertEquals("Memory resource is not match.", oldCapacity.getMemorySize(), 4096);
10641066
assertEquals("CPU resource is not match.", oldCapacity.getVirtualCores(), 4);
1067+
assertFalse("updatedCapability should be false.",
1068+
node.isUpdatedCapability());
10651069
node.handle(new RMNodeEvent(node.getNodeID(),
10661070
RMNodeEventType.RECOMMISSION));
10671071
Resource originalCapacity = node.getOriginalTotalCapability();
10681072
assertEquals("Original total capability not null after recommission", null, originalCapacity);
1073+
assertTrue("updatedCapability should be set.", node.isUpdatedCapability());
10691074
}
10701075

10711076
@Test

0 commit comments

Comments
 (0)