sodonnel commented on PR #6558:
URL: https://github.com/apache/ozone/pull/6558#issuecomment-2066139668

   My first thought on this, is that if the placement policy already excludes 
decommissioning nodes via the `isValidateNode` method at the end, could we 
simply add all decommissioning nodes (and we probably need to include 
manintenance nodes too) to the exclude list at the start in the placement 
policy. That way it would fix it for all callers in one place.
   
   Eg we already have this as the entry point in SCMCommonPlacementPolicy and 
it has access to NodeManager I think, so we could add to the exclude list right 
at the start:
   
   ```
     @Override
     public final List<DatanodeDetails> chooseDatanodes(
             List<DatanodeDetails> usedNodes,
             List<DatanodeDetails> excludedNodes,
             List<DatanodeDetails> favoredNodes,
             int nodesRequired, long metadataSizeRequired, long 
dataSizeRequired)
             throws SCMException {
   /*
     This method calls the chooseDatanodeInternal after fixing
     the excludeList to get the DatanodeDetails from the node manager.
     When the object of the Class DataNodeDetails is built from protobuf
     only UUID of the datanode is added which is used for the hashcode.
     Thus not passing any information about the topology. While excluding
     datanodes the object is built from protobuf @Link {ExcludeList.java}.
     NetworkTopology removes all nodes from the list which does not fall under
     the scope while selecting a random node. Default scope value is
     "/default-rack/" which won't match the required scope. Thus passing the 
proper
     object of DatanodeDetails(with Topology Information) while trying to get 
the
     random node from NetworkTopology should fix this. Check HDDS-7015
    */
       return chooseDatanodesInternal(validateDatanodes(usedNodes),
               validateDatanodes(excludedNodes), favoredNodes, nodesRequired,
               metadataSizeRequired, dataSizeRequired);
     }
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to