sodonnel commented on a change in pull request #2377:
URL: https://github.com/apache/ozone/pull/2377#discussion_r666399176
##########
File path:
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/states/NodeStateMap.java
##########
@@ -79,7 +86,10 @@ public void addNode(DatanodeDetails datanodeDetails,
NodeStatus nodeStatus)
if (nodeMap.containsKey(id)) {
throw new NodeAlreadyExistsException("Node UUID: " + id);
}
- nodeMap.put(id, new DatanodeInfo(datanodeDetails, nodeStatus));
+ DatanodeInfo datanodeInfo = new DatanodeInfo(datanodeDetails,
nodeStatus);
+ // Make sure nodes in topology tree has all DN info.
+ clusterMap.add(datanodeInfo);
+ nodeMap.put(id, datanodeInfo);
Review comment:
SCMContainerPlacementRackAware already has a NodeManager instance passed
into it. I think this change would be cleaner and safer if we just used
NodeManager to lookup the NodeStatus. Then all the locks are obeyed and
DatanodeInfo is stored only in a single place.
~~The problem then is that the NetworkToplogy instance holds only a Node
instance. But we need a DatanodeDetails instance (which extends Node) to query
NodeManager to get the NodeStatus. ~~
I checked further and the NetworkTopology is given a DatanodeDetails object
on registration as the "node" interface is cast back to DatanodeDetails when
the list of picked nodes is returned. So I think we can just do:
```
getNodeManager().getNodeStatus((DatanodeDetails) firstNode);
```
Rather than changing what is stored in the NetworkTopology object at the
moment. In general, there will be few nodes that are not IN_SERVICE, so it
should not need many lookups.
However this causes me to ask - should we remove a dead node from the
topology so it is never selected via the DeadNodeHandler and then add it back
via the NonHealthyToHealthyNodeHandler?
--
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]