Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 1715B200D5C for ; Fri, 15 Dec 2017 19:39:02 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 15B29160C04; Fri, 15 Dec 2017 18:39:02 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 2921F160C14 for ; Fri, 15 Dec 2017 19:39:01 +0100 (CET) Received: (qmail 95955 invoked by uid 500); 15 Dec 2017 18:38:52 -0000 Mailing-List: contact common-commits-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list common-commits@hadoop.apache.org Received: (qmail 95594 invoked by uid 99); 15 Dec 2017 18:38:52 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 15 Dec 2017 18:38:52 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 36B92F1761; Fri, 15 Dec 2017 18:38:47 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: virajith@apache.org To: common-commits@hadoop.apache.org Date: Fri, 15 Dec 2017 18:38:53 -0000 Message-Id: <89d0aded8a564a619cdde00076a7b2cc@git.apache.org> In-Reply-To: <2758d1626bbe4b299c3edd88e5cd8512@git.apache.org> References: <2758d1626bbe4b299c3edd88e5cd8512@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [07/50] [abbrv] hadoop git commit: HDFS-12819. Setting/Unsetting EC policy shows warning if the directory is not empty. (Contributed by Lei (Eddy) Xu) archived-at: Fri, 15 Dec 2017 18:39:02 -0000 HDFS-12819. Setting/Unsetting EC policy shows warning if the directory is not empty. (Contributed by Lei (Eddy) Xu) Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/1c15b175 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/1c15b175 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/1c15b175 Branch: refs/heads/HDFS-9806 Commit: 1c15b1751c0698bd3063d5c25f556d4821b161d2 Parents: 6681dd1 Author: Lei Xu Authored: Fri Dec 15 10:04:43 2017 -0800 Committer: Lei Xu Committed: Fri Dec 15 10:04:43 2017 -0800 ---------------------------------------------------------------------- .../org/apache/hadoop/hdfs/tools/ECAdmin.java | 14 ++++++++ .../test/resources/testErasureCodingConf.xml | 37 ++++++++++++++++++++ 2 files changed, 51 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/1c15b175/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/ECAdmin.java ---------------------------------------------------------------------- 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 a28f227..e30b083 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 @@ -19,7 +19,9 @@ package org.apache.hadoop.hdfs.tools; import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configured; +import org.apache.hadoop.fs.FileStatus; import org.apache.hadoop.fs.Path; +import org.apache.hadoop.fs.RemoteIterator; import org.apache.hadoop.hdfs.DistributedFileSystem; import org.apache.hadoop.hdfs.protocol.AddErasureCodingPolicyResponse; import org.apache.hadoop.hdfs.protocol.ErasureCodingPolicy; @@ -362,6 +364,12 @@ public class ECAdmin extends Configured implements Tool { System.out.println("Set erasure coding policy " + ecPolicyName + " 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); + } } catch (Exception e) { System.err.println(AdminHelper.prettifyException(e)); return 3; @@ -412,6 +420,12 @@ public class ECAdmin extends Configured implements Tool { try { dfs.unsetErasureCodingPolicy(p); System.out.println("Unset erasure coding policy from " + path); + RemoteIterator dirIt = dfs.listStatusIterator(p); + if (dirIt.hasNext()) { + System.out.println("Warning: unsetting erasure coding policy on a " + + "non-empty directory will not automatically convert existing" + + " files to replicated data."); + } } catch (Exception e) { System.err.println(AdminHelper.prettifyException(e)); return 2; http://git-wip-us.apache.org/repos/asf/hadoop/blob/1c15b175/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 9988ff3..e667213 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/resources/testErasureCodingConf.xml +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/resources/testErasureCodingConf.xml @@ -299,6 +299,24 @@ + setPolicy : set policy on non-empty directory + + -fs NAMENODE -mkdir /ecdir + -fs NAMENODE -touchz /ecdir/file1 + -fs NAMENODE -setPolicy -policy RS-6-3-1024k -path /ecdir + + + -fs NAMENODE -rm -R /ecdir + + + + SubstringComparator + Warning: setting erasure coding policy on an non-empty directory will not automatically convert existing data to RS-6-3-1024 + + + + + unsetPolicy : unset inherited EC policy, has no effect -fs NAMENODE -mkdir /ecdir @@ -322,6 +340,25 @@ + unsetPolicy : unset policy on non-empty directory + + -fs NAMENODE -mkdir /ecdir + -fs NAMENODE -setPolicy -policy RS-6-3-1024k -path /ecdir + -fs NAMENODE -touchz /ecdir/file1 + -fs NAMENODE -unsetPolicy -path /ecdir + + + -fs NAMENODE -rm -R /ecdir + + + + SubstringComparator + Warning: unsetting erasure coding policy on an non-empty directory will not automatically convert existing data to replicated data + + + + + getPolicy : get EC policy information at specified path, which doesn't have an EC policy -fs NAMENODE -mkdir /noec --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org For additional commands, e-mail: common-commits-help@hadoop.apache.org