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 0945d72268..190ddd64a1 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)
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/bin/hdfs b/hadoop-hdfs-project/hadoop-hdfs/src/main/bin/hdfs
index 84c79b8a2f..5ee7f4d59f 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"
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 d53844da7c..2b6a6a5206 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 @@ protected void processPath(PathData item) throws IOException {
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 @@ protected void processPath(PathData item) throws IOException {
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());
}
}
}
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 b7b29d3a69..66892f0a01 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/test/resources/testErasureCodingConf.xml
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/resources/testErasureCodingConf.xml
@@ -122,6 +122,24 @@
+
+ createZone : create a zone twice
+
+ -fs NAMENODE -mkdir /eczone
+ -fs NAMENODE -createZone /eczone
+ -fs NAMENODE -createZone /eczone
+
+
+ -fs NAMENODE -rmdir /eczone
+
+
+
+ SubstringComparator
+ Directory /eczone is already in an erasure coding zone
+
+
+
+
createZone : default schema
@@ -140,6 +158,23 @@
+
+ getZoneInfo : get information about the EC zone at specified path not in zone
+
+ -fs NAMENODE -mkdir /noec
+ -fs NAMENODE -getZoneInfo /noec
+
+
+ -fs NAMENODE -rmdir /noec
+
+
+
+ SubstringComparator
+ Path NAMENODE/noec is not in EC zone
+
+
+
+
getZoneInfo : get information about the EC zone at specified path