This is an automated email from the ASF dual-hosted git repository.
apurtell pushed a commit to branch branch-1
in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/branch-1 by this push:
new 20759a3 HBASE-20870 Wrong HBase root dir in ITBLL's Search Tool
20759a3 is described below
commit 20759a3c7eed1a617d5ffc38343b9cee34a4ca0b
Author: Allan Yang <[email protected]>
AuthorDate: Fri Jul 20 11:22:03 2018 +0800
HBASE-20870 Wrong HBase root dir in ITBLL's Search Tool
Conflicts:
hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestingUtility.java
hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
Amending-Author: Andrew Purtell <[email protected]>
---
.../org/apache/hadoop/hbase/IntegrationTestingUtility.java | 13 +++++++++++++
.../java/org/apache/hadoop/hbase/HBaseTestingUtility.java | 14 ++++++++++++++
2 files changed, 27 insertions(+)
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 fcda1b0..6309fce 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
@@ -132,7 +132,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();
+ 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 " + HConstants.HBASE_DIR + " to " +
conf.get(HConstants.HBASE_DIR) +
+ " since it is a distributed cluster");
Class<? extends ClusterManager> clusterManagerClass =
conf.getClass(HBASE_CLUSTER_MANAGER_CLASS,
DEFAULT_HBASE_CLUSTER_MANAGER_CLASS, ClusterManager.class);
ClusterManager clusterManager = ReflectionUtils.newInstance(
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 5838fff..384b3cb 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
@@ -304,6 +304,20 @@ public class HBaseTestingUtility extends
HBaseCommonTestingUtility {
// a hbase checksum verification failure will cause unit tests to fail
ChecksumUtil.generateExceptionForChecksumFailureForTest(true);
+
+ // Save this for when setting default file:// breaks things
+ 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();
+ this.conf.set("fs.defaultFS","file:///");
+ this.conf.set(HConstants.HBASE_DIR, "file://" + dataTestDir);
+ LOG.debug("Setting " + HConstants.HBASE_DIR + " to " + dataTestDir);
}
/**