Return-Path: X-Original-To: apmail-hadoop-common-commits-archive@www.apache.org Delivered-To: apmail-hadoop-common-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C00721818A for ; Tue, 1 Dec 2015 22:37:34 +0000 (UTC) Received: (qmail 8300 invoked by uid 500); 1 Dec 2015 22:37:21 -0000 Delivered-To: apmail-hadoop-common-commits-archive@hadoop.apache.org Received: (qmail 6156 invoked by uid 500); 1 Dec 2015 22:37:20 -0000 Mailing-List: contact common-commits-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: common-dev@hadoop.apache.org Delivered-To: mailing list common-commits@hadoop.apache.org Received: (qmail 4697 invoked by uid 99); 1 Dec 2015 22:37:19 -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; Tue, 01 Dec 2015 22:37:19 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 42286E0A02; Tue, 1 Dec 2015 22:37:19 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: szetszwo@apache.org To: common-commits@hadoop.apache.org Date: Tue, 01 Dec 2015 22:37:48 -0000 Message-Id: In-Reply-To: <78146cb6c18c4535bdd371119eaaf7e9@git.apache.org> References: <78146cb6c18c4535bdd371119eaaf7e9@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [31/46] hadoop git commit: HDFS-9451. Clean up depreated umasks and related unit tests. Contributed by Wei-Chiu Chuang. HDFS-9451. Clean up depreated umasks and related unit tests. Contributed by Wei-Chiu Chuang. Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/b21dffb1 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/b21dffb1 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/b21dffb1 Branch: refs/heads/HDFS-1312 Commit: b21dffb1fec376784810af89cfc9cc05e5f781ce Parents: 95d5227 Author: Haohui Mai Authored: Wed Nov 25 12:47:24 2015 -0800 Committer: Haohui Mai Committed: Wed Nov 25 12:47:24 2015 -0800 ---------------------------------------------------------------------- .../hadoop/fs/permission/FsPermission.java | 7 ------ .../hadoop/fs/permission/TestFsPermission.java | 10 --------- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 3 +++ .../apache/hadoop/security/TestPermission.java | 23 +++++--------------- 4 files changed, 8 insertions(+), 35 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/b21dffb1/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/permission/FsPermission.java ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/permission/FsPermission.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/permission/FsPermission.java index d4adbb5..b535fd6 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/permission/FsPermission.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/permission/FsPermission.java @@ -215,9 +215,6 @@ public class FsPermission implements Writable { otheraction.and(umask.otheraction.not())); } - /** umask property label deprecated key and code in getUMask method - * to accommodate it may be removed in version .23 */ - public static final String DEPRECATED_UMASK_LABEL = "dfs.umask"; public static final String UMASK_LABEL = CommonConfigurationKeys.FS_PERMISSIONS_UMASK_KEY; public static final int DEFAULT_UMASK = @@ -236,8 +233,6 @@ public class FsPermission implements Writable { * '-' sets bits in the mask. * * Octal umask, the specified bits are set in the file mode creation mask. - * - * {@code DEPRECATED_UMASK_LABEL} config param has umask value set to decimal. */ public static FsPermission getUMask(Configuration conf) { int umask = DEFAULT_UMASK; @@ -246,7 +241,6 @@ public class FsPermission implements Writable { // If the deprecated key is not present then check for the new key if(conf != null) { String confUmask = conf.get(UMASK_LABEL); - int oldUmask = conf.getInt(DEPRECATED_UMASK_LABEL, Integer.MIN_VALUE); try { if(confUmask != null) { umask = new UmaskParser(confUmask).getUMask(); @@ -290,7 +284,6 @@ public class FsPermission implements Writable { /** Set the user file creation mask (umask) */ public static void setUMask(Configuration conf, FsPermission umask) { conf.set(UMASK_LABEL, String.format("%1$03o", umask.toShort())); - conf.setInt(DEPRECATED_UMASK_LABEL, umask.toShort()); } /** http://git-wip-us.apache.org/repos/asf/hadoop/blob/b21dffb1/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/permission/TestFsPermission.java ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/permission/TestFsPermission.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/permission/TestFsPermission.java index 45d6e1a..04dbe01 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/permission/TestFsPermission.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/permission/TestFsPermission.java @@ -695,14 +695,4 @@ public class TestFsPermission extends TestCase { msg.contains(umask) && msg.contains("octal or symbolic"); } - - // Ensure that when the deprecated decimal umask key is used, it is correctly - // parsed as such and converted correctly to an FsPermission value - public void testDeprecatedUmask() { - Configuration conf = new Configuration(); - conf.set(FsPermission.DEPRECATED_UMASK_LABEL, "302"); // 302 = 0456 - FsPermission umask = FsPermission.getUMask(conf); - - assertEquals(0456, umask.toShort()); - } } http://git-wip-us.apache.org/repos/asf/hadoop/blob/b21dffb1/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index 707684b..957087e 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -868,6 +868,9 @@ Trunk (Unreleased) HDFS-9348. Erasure Coding: DFS GetErasureCodingPolicy API on a non-existent file should be handled properly. (Rakesh R via umamahesh) + HDFS-9451. Clean up depreated umasks and related unit tests. + (Wei-Chiu Chuang via wheat9) + Release 2.8.0 - UNRELEASED NEW FEATURES http://git-wip-us.apache.org/repos/asf/hadoop/blob/b21dffb1/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/security/TestPermission.java ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/security/TestPermission.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/security/TestPermission.java index 425c82e..27af49c 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/security/TestPermission.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/security/TestPermission.java @@ -83,31 +83,18 @@ public class TestPermission { Configuration conf = new Configuration(); FsPermission.setUMask(conf, perm); assertEquals(18, FsPermission.getUMask(conf).toShort()); - - // Test 2 - old configuration key set with decimal - // umask value should be handled - perm = new FsPermission((short)18); - conf = new Configuration(); - conf.set(FsPermission.DEPRECATED_UMASK_LABEL, "18"); - assertEquals(18, FsPermission.getUMask(conf).toShort()); - - // Test 3 - old configuration key overrides the new one - conf = new Configuration(); - conf.set(FsPermission.DEPRECATED_UMASK_LABEL, "18"); - conf.set(FsPermission.UMASK_LABEL, "000"); - assertEquals(18, FsPermission.getUMask(conf).toShort()); - - // Test 4 - new configuration key is handled + + // Test 2 - new configuration key is handled conf = new Configuration(); conf.set(FsPermission.UMASK_LABEL, "022"); assertEquals(18, FsPermission.getUMask(conf).toShort()); - // Test 5 - equivalent valid umask + // Test 3 - equivalent valid umask conf = new Configuration(); conf.set(FsPermission.UMASK_LABEL, "0022"); assertEquals(18, FsPermission.getUMask(conf).toShort()); - // Test 6 - invalid umask + // Test 4 - invalid umask conf = new Configuration(); conf.set(FsPermission.UMASK_LABEL, "1222"); try { @@ -117,7 +104,7 @@ public class TestPermission { //pass, exception successfully trigger } - // Test 7 - invalid umask + // Test 5 - invalid umask conf = new Configuration(); conf.set(FsPermission.UMASK_LABEL, "01222"); try {