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 55FB3200BD8 for ; Wed, 7 Dec 2016 21:55:52 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 549CB160B0C; Wed, 7 Dec 2016 20:55:52 +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 78FF5160AF9 for ; Wed, 7 Dec 2016 21:55:51 +0100 (CET) Received: (qmail 90491 invoked by uid 500); 7 Dec 2016 20:55:50 -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 90482 invoked by uid 99); 7 Dec 2016 20:55:50 -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; Wed, 07 Dec 2016 20:55:50 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 74F2EDFF56; Wed, 7 Dec 2016 20:55:50 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: stack@apache.org To: commits@hbase.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: hbase git commit: HBASE-16985 TestClusterId failed due to wrong hbase rootdir Date: Wed, 7 Dec 2016 20:55:50 +0000 (UTC) archived-at: Wed, 07 Dec 2016 20:55:52 -0000 Repository: hbase Updated Branches: refs/heads/branch-1.2 9a5d1b689 -> 39d344fe7 HBASE-16985 TestClusterId failed due to wrong hbase rootdir Signed-off-by: Michael Stack Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/39d344fe Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/39d344fe Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/39d344fe Branch: refs/heads/branch-1.2 Commit: 39d344fe77282a254098dc989ed3332704e24a50 Parents: 9a5d1b6 Author: Guanghao Zhang Authored: Thu Nov 10 13:10:16 2016 +0800 Committer: Michael Stack Committed: Wed Dec 7 12:55:40 2016 -0800 ---------------------------------------------------------------------- .../org/apache/hadoop/hbase/master/HMaster.java | 2 +- .../hbase/regionserver/HRegionServer.java | 41 ++++++++++++++------ 2 files changed, 30 insertions(+), 13 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/39d344fe/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java index 124ea09..59a9faa 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java @@ -382,7 +382,7 @@ public class HMaster extends HRegionServer implements MasterServices, Server { this.rsFatals = new MemoryBoundedLogMessageBuffer( conf.getLong("hbase.master.buffer.for.rs.fatals", 1*1024*1024)); - LOG.info("hbase.rootdir=" + FSUtils.getRootDir(this.conf) + + LOG.info("hbase.rootdir=" + getRootDir() + ", hbase.cluster.distributed=" + this.conf.getBoolean(HConstants.CLUSTER_DISTRIBUTED, false)); // Disable usage of meta replicas in the master http://git-wip-us.apache.org/repos/asf/hbase/blob/39d344fe/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java index 62b4985..9fa0a69 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java @@ -559,17 +559,7 @@ public class HRegionServer extends HasThread implements useZKForAssignment = ConfigUtil.useZKForAssignment(conf); - // Set 'fs.defaultFS' to match the filesystem on hbase.rootdir else - // underlying hadoop hdfs accessors will be going against wrong filesystem - // (unless all is set to defaults). - FSUtils.setFsDefault(this.conf, FSUtils.getRootDir(this.conf)); - // Get fs instance used by this RS. Do we use checksum verification in the hbase? If hbase - // checksum verification enabled, then automatically switch off hdfs checksum verification. - boolean useHBaseChecksum = conf.getBoolean(HConstants.HBASE_CHECKSUM_VERIFICATION, true); - this.fs = new HFileSystem(this.conf, useHBaseChecksum); - this.rootDir = FSUtils.getRootDir(this.conf); - this.tableDescriptors = new FSTableDescriptors( - this.conf, this.fs, this.rootDir, !canUpdateTableDescriptor(), false); + initializeFileSystem(); service = new ExecutorService(getServerName().toShortString()); spanReceiverHost = SpanReceiverHost.getInstance(getConfiguration()); @@ -610,6 +600,20 @@ public class HRegionServer extends HasThread implements } } + private void initializeFileSystem() throws IOException { + // Set 'fs.defaultFS' to match the filesystem on hbase.rootdir else + // underlying hadoop hdfs accessors will be going against wrong filesystem + // (unless all is set to defaults). + FSUtils.setFsDefault(this.conf, FSUtils.getRootDir(this.conf)); + // Get fs instance used by this RS. Do we use checksum verification in the hbase? If hbase + // checksum verification enabled, then automatically switch off hdfs checksum verification. + boolean useHBaseChecksum = conf.getBoolean(HConstants.HBASE_CHECKSUM_VERIFICATION, true); + this.fs = new HFileSystem(this.conf, useHBaseChecksum); + this.rootDir = FSUtils.getRootDir(this.conf); + this.tableDescriptors = new FSTableDescriptors( + this.conf, this.fs, this.rootDir, !canUpdateTableDescriptor(), false); + } + /* * Returns true if configured hostname should be used */ @@ -1325,6 +1329,7 @@ public class HRegionServer extends HasThread implements protected void handleReportForDutyResponse(final RegionServerStartupResponse c) throws IOException { try { + boolean updateRootDir = false; for (NameStringPair e : c.getMapEntriesList()) { String key = e.getName(); // The hostname the master sees us as. @@ -1347,13 +1352,25 @@ public class HRegionServer extends HasThread implements } continue; } + String value = e.getValue(); + if (key.equals(HConstants.HBASE_DIR)) { + if (value != null && !value.equals(conf.get(HConstants.HBASE_DIR))) { + updateRootDir = true; + } + } + if (LOG.isDebugEnabled()) { - LOG.info("Config from master: " + key + "=" + value); + LOG.debug("Config from master: " + key + "=" + value); } this.conf.set(key, value); } + if (updateRootDir) { + // initialize file system by the config fs.defaultFS and hbase.rootdir from master + initializeFileSystem(); + } + // hack! Maps DFSClient => RegionServer for logs. HDFS made this // config param for task trackers, but we can piggyback off of it. if (this.conf.get("mapreduce.task.attempt.id") == null) {