kokonguyen191 commented on code in PR #8386:
URL: https://github.com/apache/hadoop/pull/8386#discussion_r3115703263
##########
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/net/DFSNetworkTopology.java:
##########
@@ -385,6 +385,14 @@ private ArrayList<DFSTopologyNodeImpl> getEligibleChildren(
} else if (excludedNode instanceof DFSTopologyNodeImpl) {
storageCount -= ((DFSTopologyNodeImpl) excludedNode)
.getSubtreeStorageCount(type);
+ } else if (excludedNode instanceof DatanodeInfo) {
+ String nodeLocation = excludedNode.getNetworkLocation()
+ + "/" + excludedNode.getName();
+ DatanodeDescriptor dn =
(DatanodeDescriptor)getNode(nodeLocation);
Review Comment:
Nit: `DatanodeDescriptor dn = (DatanodeDescriptor) getNode(nodeLocation`
##########
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/net/DFSNetworkTopology.java:
##########
@@ -385,6 +385,14 @@ private ArrayList<DFSTopologyNodeImpl> getEligibleChildren(
} else if (excludedNode instanceof DFSTopologyNodeImpl) {
storageCount -= ((DFSTopologyNodeImpl) excludedNode)
.getSubtreeStorageCount(type);
+ } else if (excludedNode instanceof DatanodeInfo) {
+ String nodeLocation = excludedNode.getNetworkLocation()
+ + "/" + excludedNode.getName();
Review Comment:
Maybe can use `NetworkTopology#PATH_SEPARATOR_STR` instead of magic string
`"/"`?
##########
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/net/DFSNetworkTopology.java:
##########
@@ -385,6 +385,14 @@ private ArrayList<DFSTopologyNodeImpl> getEligibleChildren(
} else if (excludedNode instanceof DFSTopologyNodeImpl) {
storageCount -= ((DFSTopologyNodeImpl) excludedNode)
.getSubtreeStorageCount(type);
+ } else if (excludedNode instanceof DatanodeInfo) {
+ String nodeLocation = excludedNode.getNetworkLocation()
+ + "/" + excludedNode.getName();
+ DatanodeDescriptor dn =
(DatanodeDescriptor)getNode(nodeLocation);
+ if (dn == null) {
+ continue;
+ }
+ storageCount -= dn.hasStorageType(type)? 1 : 0;
Review Comment:
Nit: `storageCount -= dn.hasStorageType(type) ? 1 : 0;`
--
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]