From b4e852eabe7304d1bf2b9a1f2e3f6031ad2474f7 Mon Sep 17 00:00:00 2001 From: Ayush Saxena Date: Thu, 25 Apr 2019 20:35:41 +0530 Subject: [PATCH] HDFS-14457. RBF: Add order text SPACE in CLI command 'hdfs dfsrouteradmin'. Contributed by luhuachao. --- .../hadoop/hdfs/tools/federation/RouterAdmin.java | 7 ++++--- .../server/federation/router/TestRouterAdminCLI.java | 12 ++++++++---- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/tools/federation/RouterAdmin.java b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/tools/federation/RouterAdmin.java index 8f6d917d3a6..4b505344751 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/tools/federation/RouterAdmin.java +++ b/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 " - + "[-readonly] [-faulttolerant] [-order HASH|LOCAL|RANDOM|HASH_ALL] " + + "[-readonly] [-faulttolerant] " + + "[-order HASH|LOCAL|RANDOM|HASH_ALL|SPACE] " + "-owner -group -mode ]"; } else if (cmd.equals("-update")) { return "\t[-update " + " [ ] " - + "[-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 -group -mode ]"; } else if (cmd.equals("-rm")) { return "\t[-rm ]"; diff --git a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterAdminCLI.java b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterAdminCLI.java index ce260ec0976..5f94574178e 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterAdminCLI.java +++ b/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 " + "[-readonly] [-faulttolerant] " - + "[-order HASH|LOCAL|RANDOM|HASH_ALL] " + + "[-order HASH|LOCAL|RANDOM|HASH_ALL|SPACE] " + "-owner -group -mode ]")); out.reset(); @@ -538,7 +539,7 @@ public class TestRouterAdminCLI { assertTrue("Wrong message: " + out, out.toString().contains( "\t[-update [ ] " + "[-readonly true|false] [-faulttolerant true|false] " - + "[-order HASH|LOCAL|RANDOM|HASH_ALL] " + + "[-order HASH|LOCAL|RANDOM|HASH_ALL|SPACE] " + "-owner -group -mode ]")); out.reset(); @@ -579,11 +580,13 @@ public class TestRouterAdminCLI { assertEquals(-1, ToolRunner.run(admin, argv)); String expected = "Usage: hdfs dfsrouteradmin :\n" + "\t[-add " - + "[-readonly] [-faulttolerant] [-order HASH|LOCAL|RANDOM|HASH_ALL] " + + "[-readonly] [-faulttolerant] " + + "[-order HASH|LOCAL|RANDOM|HASH_ALL|SPACE] " + "-owner -group -mode ]\n" + "\t[-update [ " + "] [-readonly true|false]" - + " [-faulttolerant true|false] [-order HASH|LOCAL|RANDOM|HASH_ALL] " + + " [-faulttolerant true|false] " + + "[-order HASH|LOCAL|RANDOM|HASH_ALL|SPACE] " + "-owner -group -mode ]\n" + "\t[-rm ]\n" + "\t[-ls ]\n" + "\t[-getDestination ]\n" @@ -1139,6 +1142,7 @@ public class TestRouterAdminCLI { testUpdateOrderMountTable(DestinationOrder.LOCAL); testUpdateOrderMountTable(DestinationOrder.RANDOM); testUpdateOrderMountTable(DestinationOrder.HASH_ALL); + testUpdateOrderMountTable(DestinationOrder.SPACE); } @Test