From 7dc79a8b5b7af0bf37d25a221be8ed446b0edb74 Mon Sep 17 00:00:00 2001 From: Xiao Chen Date: Wed, 15 Aug 2018 13:51:14 -0700 Subject: [PATCH] HDFS-13732. ECAdmin should print the policy name when an EC policy is set. Contributed by Zsolt Venczel. --- .../java/org/apache/hadoop/hdfs/tools/ECAdmin.java | 12 ++++++------ .../src/test/resources/testErasureCodingConf.xml | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) 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 56706b279f..56d453bb68 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 @@ -357,16 +357,16 @@ public int run(Configuration conf, List args) throws IOException { final DistributedFileSystem dfs = AdminHelper.getDFS(p.toUri(), conf); try { dfs.setErasureCodingPolicy(p, ecPolicyName); - if (ecPolicyName == null){ - ecPolicyName = "default"; - } - System.out.println("Set " + ecPolicyName + " erasure coding policy on" + - " " + path); + + String actualECPolicyName = dfs.getErasureCodingPolicy(p).getName(); + + System.out.println("Set " + actualECPolicyName + + " 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 " + ecPolicyName + " erasure coding policy"); + "files to " + actualECPolicyName + " 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 9070367924..b47d50f37f 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/resources/testErasureCodingConf.xml +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/resources/testErasureCodingConf.xml @@ -710,7 +710,7 @@ SubstringComparator - Set default erasure coding policy on /ecdir + Set RS-6-3-1024k erasure coding policy on /ecdir @@ -728,11 +728,11 @@ SubstringComparator - Set default erasure coding policy on /ecdir + Set RS-6-3-1024k erasure coding policy on /ecdir SubstringComparator - Warning: setting erasure coding policy on a non-empty directory will not automatically convert existing files to default erasure coding policy + Warning: setting erasure coding policy on a non-empty directory will not automatically convert existing files to RS-6-3-1024k erasure coding policy