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 5B71D18E8A for ; Thu, 7 Jan 2016 22:41:35 +0000 (UTC) Received: (qmail 39612 invoked by uid 500); 7 Jan 2016 22:41:20 -0000 Delivered-To: apmail-hadoop-common-commits-archive@hadoop.apache.org Received: (qmail 38453 invoked by uid 500); 7 Jan 2016 22:41: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 36743 invoked by uid 99); 7 Jan 2016 22:41: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; Thu, 07 Jan 2016 22:41:19 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 3016AE3826; Thu, 7 Jan 2016 22:41:19 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: arp@apache.org To: common-commits@hadoop.apache.org Date: Thu, 07 Jan 2016 22:42:00 -0000 Message-Id: <8289c29356574695b69c3e556b629c94@git.apache.org> In-Reply-To: <1c4d080514674159aa14941e51338ad6@git.apache.org> References: <1c4d080514674159aa14941e51338ad6@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [43/50] [abbrv] hadoop git commit: HADOOP-12663. Remove Hard-Coded Values From FileSystem.java. (BELUGA BEHR via stevel) HADOOP-12663. Remove Hard-Coded Values From FileSystem.java. (BELUGA BEHR via stevel) Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/3fcdbe07 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/3fcdbe07 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/3fcdbe07 Branch: refs/heads/HDFS-1312 Commit: 3fcdbe076fc2bffbe262ba2b2dbd99dc67df4839 Parents: 21beded Author: Steve Loughran Authored: Thu Jan 7 14:45:19 2016 +0000 Committer: Steve Loughran Committed: Thu Jan 7 14:45:34 2016 +0000 ---------------------------------------------------------------------- hadoop-common-project/hadoop-common/CHANGES.txt | 4 ++- .../java/org/apache/hadoop/fs/FileSystem.java | 35 ++++++++++++-------- 2 files changed, 24 insertions(+), 15 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/3fcdbe07/hadoop-common-project/hadoop-common/CHANGES.txt ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index d395b8a..258b4e0 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -656,7 +656,9 @@ Release 2.9.0 - UNRELEASED HADOOP-12566. Add NullGroupMapping. (Daniel Templeton via kasha) - OPTIMIZATIONS + HADOOP-12663. Remove Hard-Coded Values From FileSystem.java. + (BELUGA BEHR via stevel) + BUG FIXES http://git-wip-us.apache.org/repos/asf/hadoop/blob/3fcdbe07/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java index 5d02fcf..a3fbe33 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java @@ -74,6 +74,8 @@ import org.apache.htrace.core.TraceScope; import com.google.common.annotations.VisibleForTesting; +import static org.apache.hadoop.fs.CommonConfigurationKeysPublic.*; + /**************************************************************** * An abstract base class for a fairly generic filesystem. It * may be implemented as a distributed filesystem, or as a "local" @@ -730,9 +732,9 @@ public abstract class FileSystem extends Configured implements Closeable { conf.getInt("io.bytes.per.checksum", 512), 64 * 1024, getDefaultReplication(), - conf.getInt("io.file.buffer.size", 4096), + conf.getInt(IO_FILE_BUFFER_SIZE_KEY, IO_FILE_BUFFER_SIZE_DEFAULT), false, - CommonConfigurationKeysPublic.FS_TRASH_INTERVAL_DEFAULT, + FS_TRASH_INTERVAL_DEFAULT, DataChecksum.Type.CRC32); } @@ -772,7 +774,8 @@ public abstract class FileSystem extends Configured implements Closeable { * @param f the file to open */ public FSDataInputStream open(Path f) throws IOException { - return open(f, getConf().getInt("io.file.buffer.size", 4096)); + return open(f, getConf().getInt(IO_FILE_BUFFER_SIZE_KEY, + IO_FILE_BUFFER_SIZE_DEFAULT)); } /** @@ -793,7 +796,8 @@ public abstract class FileSystem extends Configured implements Closeable { public FSDataOutputStream create(Path f, boolean overwrite) throws IOException { return create(f, overwrite, - getConf().getInt("io.file.buffer.size", 4096), + getConf().getInt(IO_FILE_BUFFER_SIZE_KEY, + IO_FILE_BUFFER_SIZE_DEFAULT), getDefaultReplication(f), getDefaultBlockSize(f)); } @@ -808,7 +812,8 @@ public abstract class FileSystem extends Configured implements Closeable { public FSDataOutputStream create(Path f, Progressable progress) throws IOException { return create(f, true, - getConf().getInt("io.file.buffer.size", 4096), + getConf().getInt(IO_FILE_BUFFER_SIZE_KEY, + IO_FILE_BUFFER_SIZE_DEFAULT), getDefaultReplication(f), getDefaultBlockSize(f), progress); } @@ -822,7 +827,8 @@ public abstract class FileSystem extends Configured implements Closeable { public FSDataOutputStream create(Path f, short replication) throws IOException { return create(f, true, - getConf().getInt("io.file.buffer.size", 4096), + getConf().getInt(IO_FILE_BUFFER_SIZE_KEY, + IO_FILE_BUFFER_SIZE_DEFAULT), replication, getDefaultBlockSize(f)); } @@ -838,11 +844,9 @@ public abstract class FileSystem extends Configured implements Closeable { public FSDataOutputStream create(Path f, short replication, Progressable progress) throws IOException { return create(f, true, - getConf().getInt( - CommonConfigurationKeysPublic.IO_FILE_BUFFER_SIZE_KEY, - CommonConfigurationKeysPublic.IO_FILE_BUFFER_SIZE_DEFAULT), - replication, - getDefaultBlockSize(f), progress); + getConf().getInt(IO_FILE_BUFFER_SIZE_KEY, + IO_FILE_BUFFER_SIZE_DEFAULT), + replication, getDefaultBlockSize(f), progress); } @@ -1151,19 +1155,22 @@ public abstract class FileSystem extends Configured implements Closeable { if (exists(f)) { return false; } else { - create(f, false, getConf().getInt("io.file.buffer.size", 4096)).close(); + create(f, false, getConf().getInt(IO_FILE_BUFFER_SIZE_KEY, + IO_FILE_BUFFER_SIZE_DEFAULT)).close(); return true; } } /** * Append to an existing file (optional operation). - * Same as append(f, getConf().getInt("io.file.buffer.size", 4096), null) + * Same as append(f, getConf().getInt(IO_FILE_BUFFER_SIZE_KEY, + * IO_FILE_BUFFER_SIZE_DEFAULT), null) * @param f the existing file to be appended. * @throws IOException */ public FSDataOutputStream append(Path f) throws IOException { - return append(f, getConf().getInt("io.file.buffer.size", 4096), null); + return append(f, getConf().getInt(IO_FILE_BUFFER_SIZE_KEY, + IO_FILE_BUFFER_SIZE_DEFAULT), null); } /** * Append to an existing file (optional operation).