HDFS-8364. Erasure coding: fix some minor bugs in EC CLI (Contributed by Walter Su)

This commit is contained in:
Vinayakumar B 2015-05-13 12:43:39 +05:30 committed by Zhe Zhang
parent 9798065cbb
commit bba15e06d2
4 changed files with 47 additions and 4 deletions

View File

@ -209,3 +209,6 @@
HDFS-8195. Erasure coding: Fix file quota change when we complete/commit HDFS-8195. Erasure coding: Fix file quota change when we complete/commit
the striped blocks. (Takuya Fukudome via zhz) the striped blocks. (Takuya Fukudome via zhz)
HDFS-8364. Erasure coding: fix some minor bugs in EC CLI
(Walter Su via vinayakumarb)

View File

@ -28,6 +28,7 @@ function hadoop_usage
echo " datanode run a DFS datanode" echo " datanode run a DFS datanode"
echo " dfs run a filesystem command on the file system" echo " dfs run a filesystem command on the file system"
echo " dfsadmin run a DFS admin client" echo " dfsadmin run a DFS admin client"
echo " erasurecode configure HDFS erasure coding zones"
echo " fetchdt fetch a delegation token from the NameNode" echo " fetchdt fetch a delegation token from the NameNode"
echo " fsck run a DFS filesystem checking utility" echo " fsck run a DFS filesystem checking utility"
echo " getconf get config values from configuration" echo " getconf get config values from configuration"

View File

@ -135,7 +135,7 @@ public abstract class ECCommand extends Command {
out.println("EC Zone created successfully at " + item.path); out.println("EC Zone created successfully at " + item.path);
} catch (IOException e) { } catch (IOException e) {
throw new IOException("Unable to create EC zone for the path " 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; DistributedFileSystem dfs = (DistributedFileSystem) item.fs;
try { try {
ErasureCodingZoneInfo ecZoneInfo = dfs.getErasureCodingZoneInfo(item.path); 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) { } catch (IOException e) {
throw new IOException("Unable to create EC zone for the path " throw new IOException("Unable to get EC zone for the path "
+ item.path, e); + item.path + ". " + e.getMessage());
} }
} }
} }

View File

@ -122,6 +122,24 @@
</comparators> </comparators>
</test> </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> <test>
<description>createZone : default schema</description> <description>createZone : default schema</description>
<test-commands> <test-commands>
@ -140,6 +158,23 @@
</comparators> </comparators>
</test> </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> <test>
<description>getZoneInfo : get information about the EC zone at specified path</description> <description>getZoneInfo : get information about the EC zone at specified path</description>
<test-commands> <test-commands>