Browse Source

HDFS-14457. RBF: Add order text SPACE in CLI command 'hdfs dfsrouteradmin'. Contributed by luhuachao.

Ayush Saxena 6 years ago
parent
commit
b4e852eabe

+ 4 - 3
hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/tools/federation/RouterAdmin.java

@@ -140,13 +140,14 @@ public class RouterAdmin extends Configured implements Tool {
     }
     if (cmd.equals("-add")) {
       return "\t[-add <source> <nameservice1, nameservice2, ...> <destination> "
-          + "[-readonly] [-faulttolerant] [-order HASH|LOCAL|RANDOM|HASH_ALL] "
+          + "[-readonly] [-faulttolerant] "
+          + "[-order HASH|LOCAL|RANDOM|HASH_ALL|SPACE] "
           + "-owner <owner> -group <group> -mode <mode>]";
     } else if (cmd.equals("-update")) {
       return "\t[-update <source>"
           + " [<nameservice1, nameservice2, ...> <destination>] "
-          + "[-readonly true|false] [-faulttolerant true|false]"
-          + " [-order HASH|LOCAL|RANDOM|HASH_ALL] "
+          + "[-readonly true|false] [-faulttolerant true|false] "
+          + "[-order HASH|LOCAL|RANDOM|HASH_ALL|SPACE] "
           + "-owner <owner> -group <group> -mode <mode>]";
     } else if (cmd.equals("-rm")) {
       return "\t[-rm <source>]";

+ 8 - 4
hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterAdminCLI.java

@@ -243,6 +243,7 @@ public class TestRouterAdminCLI {
     testAddOrderMountTable(DestinationOrder.LOCAL);
     testAddOrderMountTable(DestinationOrder.RANDOM);
     testAddOrderMountTable(DestinationOrder.HASH_ALL);
+    testAddOrderMountTable(DestinationOrder.SPACE);
   }
 
   @Test
@@ -529,7 +530,7 @@ public class TestRouterAdminCLI {
     assertTrue("Wrong message: " + out, out.toString().contains(
         "\t[-add <source> <nameservice1, nameservice2, ...> <destination> "
             + "[-readonly] [-faulttolerant] "
-            + "[-order HASH|LOCAL|RANDOM|HASH_ALL] "
+            + "[-order HASH|LOCAL|RANDOM|HASH_ALL|SPACE] "
             + "-owner <owner> -group <group> -mode <mode>]"));
     out.reset();
 
@@ -538,7 +539,7 @@ public class TestRouterAdminCLI {
     assertTrue("Wrong message: " + out, out.toString().contains(
         "\t[-update <source> [<nameservice1, nameservice2, ...> <destination>] "
             + "[-readonly true|false] [-faulttolerant true|false] "
-            + "[-order HASH|LOCAL|RANDOM|HASH_ALL] "
+            + "[-order HASH|LOCAL|RANDOM|HASH_ALL|SPACE] "
             + "-owner <owner> -group <group> -mode <mode>]"));
     out.reset();
 
@@ -579,11 +580,13 @@ public class TestRouterAdminCLI {
     assertEquals(-1, ToolRunner.run(admin, argv));
     String expected = "Usage: hdfs dfsrouteradmin :\n"
         + "\t[-add <source> <nameservice1, nameservice2, ...> <destination> "
-        + "[-readonly] [-faulttolerant] [-order HASH|LOCAL|RANDOM|HASH_ALL] "
+        + "[-readonly] [-faulttolerant] "
+        + "[-order HASH|LOCAL|RANDOM|HASH_ALL|SPACE] "
         + "-owner <owner> -group <group> -mode <mode>]\n"
         + "\t[-update <source> [<nameservice1, nameservice2, ...> "
         + "<destination>] [-readonly true|false]"
-        + " [-faulttolerant true|false] [-order HASH|LOCAL|RANDOM|HASH_ALL] "
+        + " [-faulttolerant true|false] "
+        + "[-order HASH|LOCAL|RANDOM|HASH_ALL|SPACE] "
         + "-owner <owner> -group <group> -mode <mode>]\n" + "\t[-rm <source>]\n"
         + "\t[-ls <path>]\n"
         + "\t[-getDestination <path>]\n"
@@ -1139,6 +1142,7 @@ public class TestRouterAdminCLI {
     testUpdateOrderMountTable(DestinationOrder.LOCAL);
     testUpdateOrderMountTable(DestinationOrder.RANDOM);
     testUpdateOrderMountTable(DestinationOrder.HASH_ALL);
+    testUpdateOrderMountTable(DestinationOrder.SPACE);
   }
 
   @Test