diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/ECAdmin.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/ECAdmin.java index 903a1e2ef9..5f8626e070 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/ECAdmin.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/ECAdmin.java @@ -358,16 +358,16 @@ public int run(Configuration conf, List args) throws IOException { final DistributedFileSystem dfs = AdminHelper.getDFS(p.toUri(), conf); try { dfs.setErasureCodingPolicy(p, ecPolicyName); - - String actualECPolicyName = dfs.getErasureCodingPolicy(p).getName(); - - System.out.println("Set " + actualECPolicyName + - " erasure coding policy on "+ path); + if (ecPolicyName == null){ + ecPolicyName = "default"; + } + System.out.println("Set " + ecPolicyName + " erasure coding policy on" + + " " + path); RemoteIterator dirIt = dfs.listStatusIterator(p); if (dirIt.hasNext()) { System.out.println("Warning: setting erasure coding policy on a " + "non-empty directory will not automatically convert existing " + - "files to " + actualECPolicyName + " erasure coding policy"); + "files to " + ecPolicyName + " erasure coding policy"); } } catch (Exception e) { System.err.println(AdminHelper.prettifyException(e)); 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 34f5176439..6411fe6dd8 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/resources/testErasureCodingConf.xml +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/resources/testErasureCodingConf.xml @@ -734,7 +734,7 @@ SubstringComparator - Set RS-6-3-1024k erasure coding policy on /ecdir + Set default erasure coding policy on /ecdir @@ -752,11 +752,11 @@ SubstringComparator - Set RS-6-3-1024k erasure coding policy on /ecdir + Set default erasure coding policy on /ecdir SubstringComparator - Warning: setting erasure coding policy on a non-empty directory will not automatically convert existing files to RS-6-3-1024k erasure coding policy + Warning: setting erasure coding policy on a non-empty directory will not automatically convert existing files to default erasure coding policy