[ 
https://issues.apache.org/jira/browse/YARN-10647?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17288446#comment-17288446
 ] 

Qi Zhu commented on YARN-10647:
-------------------------------

[~caozhiqiang] [~ebadger]

Could you help review this?

The TestRMNodeLabelsManager failed after -YARN-10501.-

The deactivateNode should make sure the nm.labels null, to remove related.
{code:java}
public void deactivateNode(NodeId nodeId) {
  writeLock.lock();
  try {
    // save if we have a node before
    Map<String, Host> before = cloneNodeMap(ImmutableSet.of(nodeId));
    Node nm = getNMInNodeSet(nodeId);
    if (null != nm) {
      if (null == nm.labels) {
        // When node deactivated, remove the nm from node collection if no
        // labels explicitly set for this particular nm

        // Save labels first, we need to remove label->nodes relation later
        Set<String> savedNodeLabels = getLabelsOnNode(nodeId);
        
        // Remove this node in nodes collection
        nodeCollections.get(nodeId.getHost()).nms.remove(nodeId);
        
        // Remove this node in labels->node
        removeNodeFromLabels(nodeId, savedNodeLabels);
      } else {
        // set nm is not running, and its resource = 0
        nm.running = false;
        nm.resource = Resource.newInstance(0, 0);
      }
    }
    
    // get the node after edition
    Map<String, Host> after = cloneNodeMap(ImmutableSet.of(nodeId));
    
    updateResourceMappings(before, after);
  } finally {
    writeLock.unlock();
  }
}
{code}
Thanks.

> Fix TestRMNodeLabelsManager failed after YARN-10501.
> ----------------------------------------------------
>
>                 Key: YARN-10647
>                 URL: https://issues.apache.org/jira/browse/YARN-10647
>             Project: Hadoop YARN
>          Issue Type: Bug
>            Reporter: Qi Zhu
>            Assignee: Qi Zhu
>            Priority: Major
>         Attachments: YARN-10647.001.patch
>
>
> YARN-10501 introduced the TestRMNodeLabelsManager test failed.
> Because the deactive for label, should be null.
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: yarn-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: yarn-issues-h...@hadoop.apache.org

Reply via email to