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

(cherry picked from commit 81da221c75)
This commit is contained in:
bibinchundatt 2020-08-07 08:36:52 +05:30
parent ffb96775e3
commit 0c0ea4979e
3 changed files with 9 additions and 0 deletions

View File

@ -1406,6 +1406,9 @@ public class NodeStatusUpdaterImpl extends AbstractService implements
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

@ -1199,6 +1199,7 @@ public class RMNodeImpl implements RMNode, EventHandler<RMNodeEvent> {
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

@ -18,6 +18,8 @@
package org.apache.hadoop.yarn.server.resourcemanager;
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;
@ -1024,10 +1026,13 @@ public class TestRMNodeTransitions {
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