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 CD7A7200BB4 for ; Tue, 1 Nov 2016 20:51:00 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id CC3E1160B0F; Tue, 1 Nov 2016 19:51:00 +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 DD738160B0A for ; Tue, 1 Nov 2016 20:50:59 +0100 (CET) Received: (qmail 69622 invoked by uid 500); 1 Nov 2016 19:50:56 -0000 Mailing-List: contact commits-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hbase.apache.org Delivered-To: mailing list commits@hbase.apache.org Received: (qmail 69255 invoked by uid 99); 1 Nov 2016 19:50:56 -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 Nov 2016 19:50:56 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 0C3F8E38FC; Tue, 1 Nov 2016 19:50:56 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: larsh@apache.org To: commits@hbase.apache.org Date: Tue, 01 Nov 2016 19:51:17 -0000 Message-Id: <83a6103fcd2b4ec18ab90f9efad7095d@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [23/50] hbase git commit: HBASE-15129 Set default value for hbase.fs.tmp.dir rather than fully depend on hbase-default.xml (Yu Li) archived-at: Tue, 01 Nov 2016 19:51:01 -0000 HBASE-15129 Set default value for hbase.fs.tmp.dir rather than fully depend on hbase-default.xml (Yu Li) Conflicts: hbase-client/src/main/java/org/apache/hadoop/hbase/security/SecureBulkLoadUtil.java Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/e521b51e Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/e521b51e Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/e521b51e Branch: refs/heads/branch-1.0 Commit: e521b51e406e7a60d50b82d1fb3361e1a9c5880a Parents: 8f064d4 Author: Enis Soztutar Authored: Tue Feb 2 16:18:26 2016 -0800 Committer: Nick Dimiduk Committed: Thu Feb 11 09:22:33 2016 -0800 ---------------------------------------------------------------------- .../org/apache/hadoop/hbase/security/SecureBulkLoadUtil.java | 8 ++++++-- .../src/main/java/org/apache/hadoop/hbase/HConstants.java | 5 +++++ .../apache/hadoop/hbase/mapreduce/HFileOutputFormat2.java | 5 ++++- .../hadoop/hbase/mapreduce/TestHFileOutputFormat2.java | 3 ++- 4 files changed, 17 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/e521b51e/hbase-client/src/main/java/org/apache/hadoop/hbase/security/SecureBulkLoadUtil.java ---------------------------------------------------------------------- diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/security/SecureBulkLoadUtil.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/security/SecureBulkLoadUtil.java index 04bfbb5..5af6891 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/security/SecureBulkLoadUtil.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/security/SecureBulkLoadUtil.java @@ -18,9 +18,10 @@ */ package org.apache.hadoop.hbase.security; -import org.apache.hadoop.hbase.classification.InterfaceAudience; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.Path; +import org.apache.hadoop.hbase.HConstants; +import org.apache.hadoop.hbase.classification.InterfaceAudience; import org.apache.hadoop.hbase.util.Bytes; @InterfaceAudience.Private @@ -37,6 +38,9 @@ public class SecureBulkLoadUtil { } public static Path getBaseStagingDir(Configuration conf) { - return new Path(conf.get(BULKLOAD_STAGING_DIR)); + String hbaseTmpFsDir = + conf.get(HConstants.TEMPORARY_FS_DIRECTORY_KEY, + HConstants.DEFAULT_TEMPORARY_HDFS_DIRECTORY); + return new Path(conf.get(BULKLOAD_STAGING_DIR, hbaseTmpFsDir)); } } http://git-wip-us.apache.org/repos/asf/hbase/blob/e521b51e/hbase-common/src/main/java/org/apache/hadoop/hbase/HConstants.java ---------------------------------------------------------------------- diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/HConstants.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/HConstants.java index 68680b8..f1f3e1a 100644 --- a/hbase-common/src/main/java/org/apache/hadoop/hbase/HConstants.java +++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/HConstants.java @@ -1187,6 +1187,11 @@ public final class HConstants { public static final String ZK_SERVER_KERBEROS_PRINCIPAL = "hbase.zookeeper.server.kerberos.principal"; + /** Config key for hbase temporary directory in hdfs */ + public static final String TEMPORARY_FS_DIRECTORY_KEY = "hbase.fs.tmp.dir"; + public static final String DEFAULT_TEMPORARY_HDFS_DIRECTORY = "/user/" + + System.getProperty("user.name") + "/hbase-staging"; + private HConstants() { // Can't be instantiated with this ctor. } http://git-wip-us.apache.org/repos/asf/hbase/blob/e521b51e/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/HFileOutputFormat2.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/HFileOutputFormat2.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/HFileOutputFormat2.java index 41a540b..7230f3c 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/HFileOutputFormat2.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/HFileOutputFormat2.java @@ -568,7 +568,10 @@ public class HFileOutputFormat2 Configuration conf = job.getConfiguration(); // create the partitions file FileSystem fs = FileSystem.get(conf); - Path partitionsPath = new Path(conf.get("hbase.fs.tmp.dir"), "partitions_" + UUID.randomUUID()); + String hbaseTmpFsDir = + conf.get(HConstants.TEMPORARY_FS_DIRECTORY_KEY, + HConstants.DEFAULT_TEMPORARY_HDFS_DIRECTORY); + Path partitionsPath = new Path(hbaseTmpFsDir, "partitions_" + UUID.randomUUID()); fs.makeQualified(partitionsPath); writePartitions(conf, partitionsPath, splitPoints); fs.deleteOnExit(partitionsPath); http://git-wip-us.apache.org/repos/asf/hbase/blob/e521b51e/hbase-server/src/test/java/org/apache/hadoop/hbase/mapreduce/TestHFileOutputFormat2.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/mapreduce/TestHFileOutputFormat2.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/mapreduce/TestHFileOutputFormat2.java index a8d86e9..ce3b232 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/mapreduce/TestHFileOutputFormat2.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/mapreduce/TestHFileOutputFormat2.java @@ -333,7 +333,8 @@ public class TestHFileOutputFormat2 { @Test public void testJobConfiguration() throws Exception { Configuration conf = new Configuration(this.util.getConfiguration()); - conf.set("hbase.fs.tmp.dir", util.getDataTestDir("testJobConfiguration").toString()); + conf.set(HConstants.TEMPORARY_FS_DIRECTORY_KEY, util.getDataTestDir("testJobConfiguration") + .toString()); Job job = new Job(conf); job.setWorkingDirectory(util.getDataTestDir("testJobConfiguration")); HTable table = Mockito.mock(HTable.class);