goiri commented on a change in pull request #2981:
URL: https://github.com/apache/hadoop/pull/2981#discussion_r628356897
##########
File path:
hadoop-hdfs-project/hadoop-hdfs-rbf/src/site/markdown/HDFSRouterFederation.md
##########
@@ -241,6 +241,22 @@ Mount table permission can be set by following command:
The option mode is UNIX-style permissions for the mount table. Permissions are
specified in octal, e.g. 0755. By default, this is set to 0755.
+#### Init ViewFs To Router
+Router supports initializing the ViewFS mount point to the Router. The mapping
directory protocol of ViewFS must be HDFS, and the initializer only supports
one-to-one mapping.
+
+For example, use the following viewfs to configure the initial mount table to
the router.
+
+ <configuration>
+ <property>
+ <name>fs.viewfs.mounttable.ClusterX.link./data</name>
+ <value>hdfs://nn1-clusterx.example.com:8020/data</value>
+ </property>
+ </configuration>
+
+The ViewFS mount table can be initialized to the Router by using the following
command:
+
+ [hdfs]$ $HADOOP_HOME/bin/hdfs dfsrouteradmin -initViewFsToMountTable
ClusterX
Review comment:
Can we also support an option to import the full table from ViewFs?
##########
File path:
hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterAdminCLI.java
##########
@@ -852,6 +908,7 @@ public void testInvalidArgumentMessage() throws Exception {
+ " <quota in bytes or quota size string>]\n"
+ "\t[-clrQuota <path>]\n"
+ "\t[-clrStorageTypeQuota <path>]\n"
+ +"\t[-initViewFsToMountTable <clusterName>]\n"
Review comment:
Space after +
##########
File path:
hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterAdminCLI.java
##########
@@ -700,6 +706,49 @@ public void testAddMountTableIfParentExist() throws
Exception {
}
}
+ @Test
+ public void testInitViewFsToMountTable() throws Exception {
+ // re-set system out for testing
+ System.setOut(new PrintStream(out));
+ stateStore.loadCache(MountTableStoreImpl.class, true);
+ String nnAddress = cluster.getRandomNamenode().
+ getNamenode().getHostAndPort();
+
+ String src = "/data";
+ Path destPath = new Path("hdfs://" + nnAddress + "/data");
+ String user = "user1";
+ String group = "group1";
+ String clusterName = "ClusterX";
+
+ // 0.mkdir destPath
+ hdfs.mkdirs(destPath);
+ // 1.set owner
+ hdfs.setOwner(destPath, user, group);
+ // 2.set viewFs mapping
+ admin.getConf().set(
+ "fs.viewfs.mounttable.ClusterX.link." + src, destPath.toString());
+ // 3.run initialization
+ String[] argv = new String[]{"-initViewFsToMountTable", clusterName};
+ assertEquals(0, ToolRunner.run(admin, argv));
+ // 4.gets the mount point entries
+ stateStore.loadCache(MountTableStoreImpl.class, true);
+ GetMountTableEntriesRequest getRequest = GetMountTableEntriesRequest
+ .newInstance(src);
+ GetMountTableEntriesResponse getResponse = client.getMountTableManager()
+ .getMountTableEntries(getRequest);
+ List<MountTable> mountTables = getResponse.getEntries();
+ // 5.check
+ assertEquals(1, mountTables.size());
+ MountTable mountTable = mountTables.get(0);
+ assertEquals(user, mountTable.getOwnerName());
+ assertEquals(group, mountTable.getGroupName());
+ assertEquals(destPath.toUri().getPath(), mountTable.
Review comment:
Let's assert the size of mountTable.getDestinations() and extract the
get(0)
##########
File path:
hadoop-hdfs-project/hadoop-hdfs-rbf/src/site/markdown/HDFSRouterFederation.md
##########
@@ -241,6 +241,22 @@ Mount table permission can be set by following command:
The option mode is UNIX-style permissions for the mount table. Permissions are
specified in octal, e.g. 0755. By default, this is set to 0755.
+#### Init ViewFs To Router
+Router supports initializing the ViewFS mount point to the Router. The mapping
directory protocol of ViewFS must be HDFS, and the initializer only supports
one-to-one mapping.
Review comment:
Pointer to ViewFs doc?
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]