YARN-10388. RMNode updatedCapability flag not set while RecommissionNodeTransition. Contributed by Pranjal Protim Borah

This commit is contained in:
bibinchundatt 2020-08-07 08:36:52 +05:30
parent a2610e21ed
commit 81da221c75
3 changed files with 9 additions and 0 deletions

View File

@ -1407,6 +1407,9 @@ public void run() {
if (newResource != null) {
updateNMResource(newResource);
LOG.debug("Node's resource is updated to {}", newResource);
if (!totalResource.equals(newResource)) {
LOG.info("Node's resource is updated to {}", newResource);
}
}
if (timelineServiceV2Enabled) {
updateTimelineCollectorData(response);

View File

@ -1234,6 +1234,7 @@ public void transition(RMNodeImpl rmNode, RMNodeEvent event) {
if (rmNode.originalTotalCapability != null) {
rmNode.totalCapability = rmNode.originalTotalCapability;
rmNode.originalTotalCapability = null;
rmNode.updatedCapability = true;
}
LOG.info("Node " + rmNode.nodeId + " in DECOMMISSIONING is " +
"recommissioned back to RUNNING.");

View File

@ -19,6 +19,8 @@
import static org.apache.hadoop.yarn.server.resourcemanager.MockNM.createMockNodeStatus;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.doReturn;
@ -1062,10 +1064,13 @@ public void testResourceUpdateOnRecommissioningNode() {
Resource oldCapacity = node.getTotalCapability();
assertEquals("Memory resource is not match.", oldCapacity.getMemorySize(), 4096);
assertEquals("CPU resource is not match.", oldCapacity.getVirtualCores(), 4);
assertFalse("updatedCapability should be false.",
node.isUpdatedCapability());
node.handle(new RMNodeEvent(node.getNodeID(),
RMNodeEventType.RECOMMISSION));
Resource originalCapacity = node.getOriginalTotalCapability();
assertEquals("Original total capability not null after recommission", null, originalCapacity);
assertTrue("updatedCapability should be set.", node.isUpdatedCapability());
}
@Test