[
https://issues.apache.org/jira/browse/HDFS-16791?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17614270#comment-17614270
]
ASF GitHub Bot commented on HDFS-16791:
---------------------------------------
mccormickt12 commented on code in PR #4967:
URL: https://github.com/apache/hadoop/pull/4967#discussion_r990509478
##########
hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RouterClientProtocol.java:
##########
@@ -1935,6 +1935,21 @@ public DatanodeInfo[] getSlowDatanodeReport() throws
IOException {
return rpcServer.getSlowDatanodeReport(true, 0);
}
+ @Override
+ public String getEnclosingRoot(String src) throws IOException {
+ Path mountPath = new Path("/");
Review Comment:
Thanks for the info. I added some checking here. Still need to do something
similar for viewfs since it may not have a linkfallback configured
##########
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/fs/viewfs/TestViewFileSystemHdfs.java:
##########
@@ -506,4 +508,29 @@ public void testInternalDirectoryPermissions() throws
IOException {
assertEquals(fs.getFileStatus(subDirOfInternalDir).getPermission(),
fs.getFileStatus(subDirOfRealDir).getPermission());
}
+
+ @Test
+ public void testEnclosingRootsBase() throws Exception {
+ final Path zone = new Path("/data/EZ");
+ fsTarget.mkdirs(zone);
+ final Path zone1 = new Path("/data/EZ/zone1");
+ fsTarget.mkdirs(zone1);
+
+ DFSTestUtil.createKey("test_key", cluster, 0, CONF);
+ HdfsAdmin hdfsAdmin = new HdfsAdmin(cluster.getURI(0), CONF);
+ final EnumSet<CreateEncryptionZoneFlag> provisionTrash =
+ EnumSet.of(CreateEncryptionZoneFlag.PROVISION_TRASH);
+ hdfsAdmin.createEncryptionZone(zone1, "test_key", provisionTrash);
+ RemoteIterator<EncryptionZone> zones = hdfsAdmin.listEncryptionZones();
+ assertEquals(fsView.getEnclosingRoot(zone), new Path("/data"));
+ assertEquals(fsView.getEnclosingRoot(zone1), zone1);
+
+ Path nn02Ez = new Path("/mountOnNn2/EZ");
+ fsTarget2.mkdirs(nn02Ez);
+ assertEquals(fsView.getEnclosingRoot((nn02Ez)), new Path("/mountOnNn2"));
+ HdfsAdmin hdfsAdmin2 = new HdfsAdmin(cluster.getURI(1), CONF);
+ DFSTestUtil.createKey("test_key", cluster, 1, CONF);
+ hdfsAdmin2.createEncryptionZone(nn02Ez, "test_key", provisionTrash);
+ assertEquals(fsView.getEnclosingRoot((nn02Ez)), nn02Ez);
Review Comment:
done
> New API for enclosing root path for a file
> ------------------------------------------
>
> Key: HDFS-16791
> URL: https://issues.apache.org/jira/browse/HDFS-16791
> Project: Hadoop HDFS
> Issue Type: Improvement
> Reporter: Tom McCormick
> Priority: Major
> Labels: pull-request-available
>
> At LinkedIn we run many HDFS volumes that are federated by either
> ViewFilesystem or Router Based Federation. As our number of hdfs volumes
> grows, we have a growing need to migrate data seemlessly across volumes.
> Many frameworks have a notion of staging or temp directories, but those
> directories often live in random locations. We want an API getEnclosingRoot,
> which provides the root path a file or dataset.
> In ViewFilesystem / Router Based Federation, the enclosingRoot will be the
> mount point.
> We will also take into account other restrictions for renames like
> encryptions zones.
> If there are several paths (a mount point and an encryption zone), we will
> return the longer path
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]