You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by al...@apache.org on 2018/07/20 03:16:19 UTC
hbase git commit: HBASE-20870 Wrong HBase root dir in ITBLL's Search
Tool
Repository: hbase
Updated Branches:
refs/heads/branch-2.0 e0bd4a121 -> 4932d8101
HBASE-20870 Wrong HBase root dir in ITBLL's Search Tool
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/4932d810
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/4932d810
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/4932d810
Branch: refs/heads/branch-2.0
Commit: 4932d8101a420164f6fbf418bdd252adb13f00b6
Parents: e0bd4a1
Author: Allan Yang <al...@apache.org>
Authored: Fri Jul 20 11:11:55 2018 +0800
Committer: Allan Yang <al...@apache.org>
Committed: Fri Jul 20 11:14:40 2018 +0800
----------------------------------------------------------------------
.../hadoop/hbase/IntegrationTestingUtility.java | 14 +++++++++++++-
.../org/apache/hadoop/hbase/HBaseTestingUtility.java | 8 ++++++--
2 files changed, 19 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/4932d810/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestingUtility.java
----------------------------------------------------------------------
diff --git a/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestingUtility.java b/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestingUtility.java
index a1a81ed..a9e555e 100644
--- a/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestingUtility.java
+++ b/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestingUtility.java
@@ -131,8 +131,20 @@ public class IntegrationTestingUtility extends HBaseTestingUtility {
}
public void createDistributedHBaseCluster() throws IOException {
+ //if it is a distributed HBase cluster, use the conf provided by classpath
+ //to set hbase dir and fs.defaultFS.
+ //Since when the super class HBaseTestingUtility initializing, it will
+ //change hbase.rootdir to a local test dir.
+ //we use "original.defaultFS" and "original.hbase.dir" to restore them.
Configuration conf = getConfiguration();
- conf.set("fs.defaultFS", conf.get("original.defaultFS"));
+ if (conf.get("original.defaultFS") != null) {
+ conf.set("fs.defaultFS", conf.get("original.defaultFS"));
+ }
+ if (conf.get("original.hbase.dir") != null) {
+ conf.set(HConstants.HBASE_DIR, conf.get("original.hbase.dir"));
+ }
+ LOG.debug("Setting {} to {} since it is a distributed cluster",
+ HConstants.HBASE_DIR, conf.get(HConstants.HBASE_DIR));
Class<? extends ClusterManager> clusterManagerClass = conf.getClass(HBASE_CLUSTER_MANAGER_CLASS,
DEFAULT_HBASE_CLUSTER_MANAGER_CLASS, ClusterManager.class);
ClusterManager clusterManager = ReflectionUtils.newInstance(
http://git-wip-us.apache.org/repos/asf/hbase/blob/4932d810/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
index a81ea47..d21442d 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
@@ -333,8 +333,12 @@ public class HBaseTestingUtility extends HBaseZKTestingUtility {
ChecksumUtil.generateExceptionForChecksumFailureForTest(true);
// Save this for when setting default file:// breaks things
- this.conf.set("original.defaultFS", this.conf.get("fs.defaultFS"));
-
+ if (this.conf.get("fs.defaultFS") != null) {
+ this.conf.set("original.defaultFS", this.conf.get("fs.defaultFS"));
+ }
+ if (this.conf.get(HConstants.HBASE_DIR) != null) {
+ this.conf.set("original.hbase.dir", this.conf.get(HConstants.HBASE_DIR));
+ }
// Every cluster is a local cluster until we start DFS
// Note that conf could be null, but this.conf will not be
String dataTestDir = getDataTestDir().toString();