Details
-
Improvement
-
Status: Resolved
-
Major
-
Resolution: Duplicate
-
2.7.6
-
None
Description
NetworkTopology#getLoc return a proper node after traverse ALL children of current InnerNode even if it has found expected result, based on branch-2.7. This issue may lead some performance loss especially for a large & busy cluster and many nodes under a rack. I think it should exit loop earlier rather than traverse all children of InnerNode.
private Node getLoc(String loc) { if (loc == null || loc.length() == 0) return this; String[] path = loc.split(PATH_SEPARATOR_STR, 2); Node childnode = null; for(int i=0; i<children.size(); i++) { if (children.get(i).getName().equals(path[0])) { childnode = children.get(i); } } if (childnode == null) return null; // non-existing node if (path.length == 1) return childnode; if (childnode instanceof InnerNode) { return ((InnerNode)childnode).getLoc(path[1]); } else { return null; } }
Attachments
Attachments
Issue Links
- Is contained by
-
HADOOP-12185 NetworkTopology is not efficient adding/getting/removing nodes
- Resolved
- relates to
-
HADOOP-15345 Backport HADOOP-12185 to branch-2.7: NetworkTopology is not efficient adding/getting/removing nodes
- Resolved