zhjwpku commented on a change in pull request #1670: HDFS-14925. Rename
operation should check nest snapshot
URL: https://github.com/apache/hadoop/pull/1670#discussion_r339301483
##########
File path:
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/snapshot/SnapshotManager.java
##########
@@ -288,6 +292,19 @@ public INodeDirectory getSnapshottableAncestorDir(final
INodesInPath iip)
}
}
+ public boolean isDescendantOfSnapshotRoot(INodeDirectory dir) {
+ if (dir.isSnapshottable()) {
+ return true;
+ } else {
+ for (INodeDirectory p = dir; p != null; p = p.getParent()) {
Review comment:
I see `SnapshotManager#getSnapshottableAncestorDir` uses
INode#isAncestorDirectory(), as `SnapshotManager#snapshottables` is a map, say
it has M elements, and the dir path got N elements, my solution is O(log(M) *
N) compare to your O(M*N).
I think `SnapshotManager#getSnapshottableAncestorDir` can be optimized, but
not in this patch. What do you think?
----------------------------------------------------------------
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]