jojochuang commented on a change in pull request #1040: HDFS-13693. Remove
unnecessary search in INodeDirectory.addChild during image loa…
URL: https://github.com/apache/hadoop/pull/1040#discussion_r302806213
##########
File path:
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/INodeDirectory.java
##########
@@ -572,6 +572,25 @@ public boolean addChild(INode node) {
return true;
}
+ /**
+ * During image loading, the search is unnecessary since the insert position
+ * should always be at the end of the map given the sequence they are
+ * serialized on disk.
+ */
+ public boolean addChildAtLoading(INode node) {
+ int pos;
+ if (!node.isReference()) {
+ pos = (children == null) ? (-1) : (-children.size() - 1);
+ } else {
+ pos = searchChildren(node.getLocalNameBytes());
Review comment:
can we reuse addChild() here to make it cleaner?
My understanding is that in the case of INodeReference, we fall back to the
original behavior.
That is,
`
} else {
return addChild(node);
}
`
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]