[hadoop] branch trunk updated: HDFS-15578: Fix the rename issues with fallback fs enabled (#2305). Contributed by Uma Maheswara Rao G.
This is an automated email from the ASF dual-hosted git repository. umamahesh pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/hadoop.git The following commit(s) were added to refs/heads/trunk by this push: new e4cb0d3 HDFS-15578: Fix the rename issues with fallback fs enabled (#2305). Contributed by Uma Maheswara Rao G. e4cb0d3 is described below commit e4cb0d351450dba10cd6a0a6d999cc4423f1c2a9 Author: Uma Maheswara Rao G AuthorDate: Wed Sep 16 22:43:00 2020 -0700 HDFS-15578: Fix the rename issues with fallback fs enabled (#2305). Contributed by Uma Maheswara Rao G. Co-authored-by: Uma Maheswara Rao G --- .../org/apache/hadoop/fs/viewfs/InodeTree.java | 24 +++-- .../apache/hadoop/fs/viewfs/ViewFileSystem.java| 52 +-- .../java/org/apache/hadoop/fs/viewfs/ViewFs.java | 59 +--- .../hadoop/fs/viewfs/TestViewfsFileStatus.java | 4 +- .../apache/hadoop/fs/viewfs/ViewFsBaseTest.java| 4 +- .../hadoop/fs/viewfs/TestViewFsLinkFallback.java | 101 + ...estViewDistributedFileSystemWithMountLinks.java | 95 ++- 7 files changed, 307 insertions(+), 32 deletions(-) diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/InodeTree.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/InodeTree.java index fceb73a..2a38693 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/InodeTree.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/InodeTree.java @@ -706,19 +706,27 @@ abstract class InodeTree { final T targetFileSystem; final String resolvedPath; final Path remainingPath; // to resolve in the target FileSystem +private final boolean isLastInternalDirLink; ResolveResult(final ResultKind k, final T targetFs, final String resolveP, -final Path remainingP) { +final Path remainingP, boolean isLastIntenalDirLink) { kind = k; targetFileSystem = targetFs; resolvedPath = resolveP; remainingPath = remainingP; + this.isLastInternalDirLink = isLastIntenalDirLink; } // Internal dir path resolution completed within the mount table boolean isInternalDir() { return (kind == ResultKind.INTERNAL_DIR); } + +// Indicates whether the internal dir path resolution completed at the link +// or resolved due to fallback. +boolean isLastInternalDirLink() { + return this.isLastInternalDirLink; +} } /** @@ -737,7 +745,7 @@ abstract class InodeTree { getRootDir().getInternalDirFs() : getRootLink().getTargetFileSystem(); resolveResult = new ResolveResult(ResultKind.INTERNAL_DIR, - targetFs, root.fullPath, SlashPath); + targetFs, root.fullPath, SlashPath, false); return resolveResult; } @@ -755,7 +763,8 @@ abstract class InodeTree { } remainingPath = new Path(remainingPathStr.toString()); resolveResult = new ResolveResult(ResultKind.EXTERNAL_DIR, - getRootLink().getTargetFileSystem(), root.fullPath, remainingPath); + getRootLink().getTargetFileSystem(), root.fullPath, remainingPath, + true); return resolveResult; } Preconditions.checkState(root.isInternalDir()); @@ -775,7 +784,7 @@ abstract class InodeTree { if (hasFallbackLink()) { resolveResult = new ResolveResult(ResultKind.EXTERNAL_DIR, getRootFallbackLink().getTargetFileSystem(), root.fullPath, - new Path(p)); + new Path(p), false); return resolveResult; } else { StringBuilder failedAt = new StringBuilder(path[0]); @@ -801,7 +810,8 @@ abstract class InodeTree { remainingPath = new Path(remainingPathStr.toString()); } resolveResult = new ResolveResult(ResultKind.EXTERNAL_DIR, -link.getTargetFileSystem(), nextInode.fullPath, remainingPath); +link.getTargetFileSystem(), nextInode.fullPath, remainingPath, +true); return resolveResult; } else if (nextInode.isInternalDir()) { curInode = (INodeDir) nextInode; @@ -824,7 +834,7 @@ abstract class InodeTree { remainingPath = new Path(remainingPathStr.toString()); } resolveResult = new ResolveResult(ResultKind.INTERNAL_DIR, -curInode.getInternalDirFs(), curInode.fullPath, remainingPath); +curInode.getInternalDirFs(), curInode.fullPath, remainingPath, false); return resolveResult; } @@ -874,7 +884,7 @@ abstract class InodeTree { T targetFs = getTargetFileSystem( new URI(targetOfResolvedPathStr)); return new ResolveResult(resultKind, targetFs, resolvedPathStr, - remainingPath); + remainingPath, true); } catch (IOException ex) { LOGGER.error(St
[hadoop] branch trunk updated: HDFS-15578: Fix the rename issues with fallback fs enabled (#2305). Contributed by Uma Maheswara Rao G.
This is an automated email from the ASF dual-hosted git repository. umamahesh pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/hadoop.git The following commit(s) were added to refs/heads/trunk by this push: new e4cb0d3 HDFS-15578: Fix the rename issues with fallback fs enabled (#2305). Contributed by Uma Maheswara Rao G. e4cb0d3 is described below commit e4cb0d351450dba10cd6a0a6d999cc4423f1c2a9 Author: Uma Maheswara Rao G AuthorDate: Wed Sep 16 22:43:00 2020 -0700 HDFS-15578: Fix the rename issues with fallback fs enabled (#2305). Contributed by Uma Maheswara Rao G. Co-authored-by: Uma Maheswara Rao G --- .../org/apache/hadoop/fs/viewfs/InodeTree.java | 24 +++-- .../apache/hadoop/fs/viewfs/ViewFileSystem.java| 52 +-- .../java/org/apache/hadoop/fs/viewfs/ViewFs.java | 59 +--- .../hadoop/fs/viewfs/TestViewfsFileStatus.java | 4 +- .../apache/hadoop/fs/viewfs/ViewFsBaseTest.java| 4 +- .../hadoop/fs/viewfs/TestViewFsLinkFallback.java | 101 + ...estViewDistributedFileSystemWithMountLinks.java | 95 ++- 7 files changed, 307 insertions(+), 32 deletions(-) diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/InodeTree.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/InodeTree.java index fceb73a..2a38693 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/InodeTree.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/InodeTree.java @@ -706,19 +706,27 @@ abstract class InodeTree { final T targetFileSystem; final String resolvedPath; final Path remainingPath; // to resolve in the target FileSystem +private final boolean isLastInternalDirLink; ResolveResult(final ResultKind k, final T targetFs, final String resolveP, -final Path remainingP) { +final Path remainingP, boolean isLastIntenalDirLink) { kind = k; targetFileSystem = targetFs; resolvedPath = resolveP; remainingPath = remainingP; + this.isLastInternalDirLink = isLastIntenalDirLink; } // Internal dir path resolution completed within the mount table boolean isInternalDir() { return (kind == ResultKind.INTERNAL_DIR); } + +// Indicates whether the internal dir path resolution completed at the link +// or resolved due to fallback. +boolean isLastInternalDirLink() { + return this.isLastInternalDirLink; +} } /** @@ -737,7 +745,7 @@ abstract class InodeTree { getRootDir().getInternalDirFs() : getRootLink().getTargetFileSystem(); resolveResult = new ResolveResult(ResultKind.INTERNAL_DIR, - targetFs, root.fullPath, SlashPath); + targetFs, root.fullPath, SlashPath, false); return resolveResult; } @@ -755,7 +763,8 @@ abstract class InodeTree { } remainingPath = new Path(remainingPathStr.toString()); resolveResult = new ResolveResult(ResultKind.EXTERNAL_DIR, - getRootLink().getTargetFileSystem(), root.fullPath, remainingPath); + getRootLink().getTargetFileSystem(), root.fullPath, remainingPath, + true); return resolveResult; } Preconditions.checkState(root.isInternalDir()); @@ -775,7 +784,7 @@ abstract class InodeTree { if (hasFallbackLink()) { resolveResult = new ResolveResult(ResultKind.EXTERNAL_DIR, getRootFallbackLink().getTargetFileSystem(), root.fullPath, - new Path(p)); + new Path(p), false); return resolveResult; } else { StringBuilder failedAt = new StringBuilder(path[0]); @@ -801,7 +810,8 @@ abstract class InodeTree { remainingPath = new Path(remainingPathStr.toString()); } resolveResult = new ResolveResult(ResultKind.EXTERNAL_DIR, -link.getTargetFileSystem(), nextInode.fullPath, remainingPath); +link.getTargetFileSystem(), nextInode.fullPath, remainingPath, +true); return resolveResult; } else if (nextInode.isInternalDir()) { curInode = (INodeDir) nextInode; @@ -824,7 +834,7 @@ abstract class InodeTree { remainingPath = new Path(remainingPathStr.toString()); } resolveResult = new ResolveResult(ResultKind.INTERNAL_DIR, -curInode.getInternalDirFs(), curInode.fullPath, remainingPath); +curInode.getInternalDirFs(), curInode.fullPath, remainingPath, false); return resolveResult; } @@ -874,7 +884,7 @@ abstract class InodeTree { T targetFs = getTargetFileSystem( new URI(targetOfResolvedPathStr)); return new ResolveResult(resultKind, targetFs, resolvedPathStr, - remainingPath); + remainingPath, true); } catch (IOException ex) { LOGGER.error(St