HDFS-8364. Erasure coding: fix some minor bugs in EC CLI (Contributed by Walter Su)
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/bba15e06 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/bba15e06 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/bba15e06 Branch: refs/heads/HDFS-7285 Commit: bba15e06d29d79ab1c379f258e5efb13a1ea39ae Parents: 9798065 Author: Vinayakumar B <vinayakum...@apache.org> Authored: Wed May 13 12:43:39 2015 +0530 Committer: Zhe Zhang <zhezh...@cloudera.com> Committed: Tue May 26 12:01:51 2015 -0700 ---------------------------------------------------------------------- .../hadoop-hdfs/CHANGES-HDFS-EC-7285.txt | 3 ++ .../hadoop-hdfs/src/main/bin/hdfs | 1 + .../hdfs/tools/erasurecode/ECCommand.java | 12 ++++--- .../test/resources/testErasureCodingConf.xml | 35 ++++++++++++++++++++ 4 files changed, 47 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/bba15e06/hadoop-hdfs-project/hadoop-hdfs/CHANGES-HDFS-EC-7285.txt ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES-HDFS-EC-7285.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES-HDFS-EC-7285.txt index 0945d72..190ddd6 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES-HDFS-EC-7285.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES-HDFS-EC-7285.txt @@ -209,3 +209,6 @@ HDFS-8195. Erasure coding: Fix file quota change when we complete/commit the striped blocks. (Takuya Fukudome via zhz) + + HDFS-8364. Erasure coding: fix some minor bugs in EC CLI + (Walter Su via vinayakumarb) http://git-wip-us.apache.org/repos/asf/hadoop/blob/bba15e06/hadoop-hdfs-project/hadoop-hdfs/src/main/bin/hdfs ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/bin/hdfs b/hadoop-hdfs-project/hadoop-hdfs/src/main/bin/hdfs index 84c79b8..5ee7f4d 100755 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/bin/hdfs +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/bin/hdfs @@ -28,6 +28,7 @@ function hadoop_usage echo " datanode run a DFS datanode" echo " dfs run a filesystem command on the file system" echo " dfsadmin run a DFS admin client" + echo " erasurecode configure HDFS erasure coding zones" echo " fetchdt fetch a delegation token from the NameNode" echo " fsck run a DFS filesystem checking utility" echo " getconf get config values from configuration" http://git-wip-us.apache.org/repos/asf/hadoop/blob/bba15e06/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/erasurecode/ECCommand.java ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/erasurecode/ECCommand.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/erasurecode/ECCommand.java index d53844d..2b6a6a5 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/erasurecode/ECCommand.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/erasurecode/ECCommand.java @@ -135,7 +135,7 @@ public abstract class ECCommand extends Command { out.println("EC Zone created successfully at " + item.path); } catch (IOException e) { throw new IOException("Unable to create EC zone for the path " - + item.path, e); + + item.path + ". " + e.getMessage()); } } } @@ -165,10 +165,14 @@ public abstract class ECCommand extends Command { DistributedFileSystem dfs = (DistributedFileSystem) item.fs; try { ErasureCodingZoneInfo ecZoneInfo = dfs.getErasureCodingZoneInfo(item.path); - out.println(ecZoneInfo.toString()); + if (ecZoneInfo != null) { + out.println(ecZoneInfo.toString()); + } else { + out.println("Path " + item.path + " is not in EC zone"); + } } catch (IOException e) { - throw new IOException("Unable to create EC zone for the path " - + item.path, e); + throw new IOException("Unable to get EC zone for the path " + + item.path + ". " + e.getMessage()); } } } http://git-wip-us.apache.org/repos/asf/hadoop/blob/bba15e06/hadoop-hdfs-project/hadoop-hdfs/src/test/resources/testErasureCodingConf.xml ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/resources/testErasureCodingConf.xml b/hadoop-hdfs-project/hadoop-hdfs/src/test/resources/testErasureCodingConf.xml index b7b29d3..66892f0 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/resources/testErasureCodingConf.xml +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/resources/testErasureCodingConf.xml @@ -123,6 +123,24 @@ </test> <test> + <description>createZone : create a zone twice</description> + <test-commands> + <command>-fs NAMENODE -mkdir /eczone</command> + <ec-admin-command>-fs NAMENODE -createZone /eczone</ec-admin-command> + <ec-admin-command>-fs NAMENODE -createZone /eczone</ec-admin-command> + </test-commands> + <cleanup-commands> + <command>-fs NAMENODE -rmdir /eczone</command> + </cleanup-commands> + <comparators> + <comparator> + <type>SubstringComparator</type> + <expected-output>Directory /eczone is already in an erasure coding zone</expected-output> + </comparator> + </comparators> + </test> + + <test> <description>createZone : default schema</description> <test-commands> <command>-fs NAMENODE -mkdir /eczone</command> @@ -141,6 +159,23 @@ </test> <test> + <description>getZoneInfo : get information about the EC zone at specified path not in zone</description> + <test-commands> + <command>-fs NAMENODE -mkdir /noec</command> + <ec-admin-command>-fs NAMENODE -getZoneInfo /noec</ec-admin-command> + </test-commands> + <cleanup-commands> + <command>-fs NAMENODE -rmdir /noec</command> + </cleanup-commands> + <comparators> + <comparator> + <type>SubstringComparator</type> + <expected-output>Path NAMENODE/noec is not in EC zone</expected-output> + </comparator> + </comparators> + </test> + + <test> <description>getZoneInfo : get information about the EC zone at specified path</description> <test-commands> <command>-fs NAMENODE -mkdir /eczone</command>