HDFS-15598: ViewHDFS#canonicalizeUri should not be restricted to DFS only API. (#2339). Contributed by Uma Maheswara Rao G.

Co-authored-by: Uma Maheswara Rao G <umagangumalla@cloudera.com>
This commit is contained in:
Uma Maheswara Rao G 2020-09-25 21:21:01 -07:00 committed by GitHub
parent 00c4de63cf
commit 899dea2a21
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 11 deletions

View File

@ -97,7 +97,7 @@ import static org.apache.hadoop.fs.viewfs.Constants.CONFIG_VIEWFS_IGNORE_PORT_IN
* the mount table name. * the mount table name.
* (3) If there are no mount links configured with the initializing uri's * (3) If there are no mount links configured with the initializing uri's
* hostname as the mount table name, then it will automatically consider the * hostname as the mount table name, then it will automatically consider the
* current uri as fallback( ex: fs.viewfs.mounttable.<mycluster>.linkFallBack) * current uri as fallback( ex: fs.viewfs.mounttable.<mycluster>.linkFallback)
* target fs uri. * target fs uri.
*****************************************************************************/ *****************************************************************************/
@InterfaceAudience.LimitedPrivate({ "MapReduce", "HBase", "Hive" }) @InterfaceAudience.LimitedPrivate({ "MapReduce", "HBase", "Hive" })
@ -354,4 +354,9 @@ public class ViewFileSystemOverloadScheme extends ViewFileSystem {
.getMyFs(); .getMyFs();
} }
@Override
@InterfaceAudience.LimitedPrivate("HDFS")
public URI canonicalizeUri(URI uri) {
return super.canonicalizeUri(uri);
}
} }

View File

@ -1072,16 +1072,7 @@ public class ViewDistributedFileSystem extends DistributedFileSystem {
return super.canonicalizeUri(uri); return super.canonicalizeUri(uri);
} }
ViewFileSystemOverloadScheme.MountPathInfo<FileSystem> mountPathInfo = null; return vfs.canonicalizeUri(uri);
try {
mountPathInfo = this.vfs.getMountPathInfo(new Path(uri), getConf());
} catch (IOException e) {
LOGGER.warn("Failed to resolve the uri as mount path", e);
return null;
}
checkDFS(mountPathInfo.getTargetFs(), "canonicalizeUri");
return ((DistributedFileSystem) mountPathInfo.getTargetFs())
.canonicalizeUri(uri);
} }
@Override @Override