You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by GitBox <gi...@apache.org> on 2019/07/12 02:26:20 UTC
[GitHub] [hadoop] jojochuang commented on a change in pull request #1040: HDFS-13693. Remove unnecessary search in INodeDirectory.addChild during image loa…
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org