You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ap...@apache.org on 2016/08/02 00:03:26 UTC
[2/2] hbase git commit: HBASE-16244 LocalHBaseCluster start timeout
should be configurable (Siddharth Wagle)
HBASE-16244 LocalHBaseCluster start timeout should be configurable (Siddharth Wagle)
Conflicts:
hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMasterCommandLine.java
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/8f5fe004
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/8f5fe004
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/8f5fe004
Branch: refs/heads/0.98
Commit: 8f5fe00419e4429c9c4d196354316f17c13385fe
Parents: a735f42
Author: Enis Soztutar <en...@apache.org>
Authored: Tue Jul 19 14:12:47 2016 -0700
Committer: Andrew Purtell <ap...@apache.org>
Committed: Mon Aug 1 16:59:14 2016 -0700
----------------------------------------------------------------------
.../apache/hadoop/hbase/master/HMasterCommandLine.java | 10 ++++++++--
.../java/org/apache/hadoop/hbase/util/JVMClusterUtil.java | 9 +++++++--
2 files changed, 15 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/8f5fe004/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMasterCommandLine.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMasterCommandLine.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMasterCommandLine.java
index 4403815..c2925b1 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMasterCommandLine.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMasterCommandLine.java
@@ -181,10 +181,16 @@ public class HMasterCommandLine extends ServerCommandLine {
int localZKClusterSessionTimeout =
conf.getInt(HConstants.ZK_SESSION_TIMEOUT + ".localHBaseCluster", 10*1000);
conf.setInt(HConstants.ZK_SESSION_TIMEOUT, localZKClusterSessionTimeout);
+ int mastersCount = conf.getInt("hbase.masters", 1);
+ int regionServersCount = conf.getInt("hbase.regionservers", 1);
+ // Set start timeout to 5 minutes for cmd line start operations
+ conf.setIfUnset("hbase.master.start.timeout.localHBaseCluster", "300000");
+ LOG.info("Starting up instance of localHBaseCluster; master=" + mastersCount +
+ ", regionserversCount=" + regionServersCount);
+ LocalHBaseCluster cluster = new LocalHBaseCluster(conf, mastersCount, regionServersCount,
+ LocalHMaster.class, HRegionServer.class);
// Need to have the zk cluster shutdown when master is shutdown.
// Run a subclass that does the zk cluster shutdown on its way out.
- LocalHBaseCluster cluster = new LocalHBaseCluster(conf, conf.getInt("hbase.masters", 1),
- conf.getInt("hbase.regionservers", 1), LocalHMaster.class, HRegionServer.class);
((LocalHMaster)cluster.getMaster(0)).setZKCluster(zooKeeperCluster);
cluster.startup();
waitOnMasterThreads(cluster);
http://git-wip-us.apache.org/repos/asf/hbase/blob/8f5fe004/hbase-server/src/main/java/org/apache/hadoop/hbase/util/JVMClusterUtil.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/JVMClusterUtil.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/JVMClusterUtil.java
index f6bd815..e2ee6d3 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/JVMClusterUtil.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/JVMClusterUtil.java
@@ -168,11 +168,14 @@ public class JVMClusterUtil {
public static String startup(final List<JVMClusterUtil.MasterThread> masters,
final List<JVMClusterUtil.RegionServerThread> regionservers) throws IOException {
+ Configuration configuration = null;
+
if (masters == null || masters.isEmpty()) {
return null;
}
for (JVMClusterUtil.MasterThread t : masters) {
+ configuration = t.getMaster().getConfiguration();
t.start();
}
@@ -185,8 +188,10 @@ public class JVMClusterUtil {
Thread.sleep(100);
} catch (InterruptedException ignored) {
}
- if (System.currentTimeMillis() > startTime + 30000) {
- throw new RuntimeException("Master not active after 30 seconds");
+ int startTimeout = configuration != null ? Integer.parseInt(
+ configuration.get("hbase.master.start.timeout.localHBaseCluster", "30000")) : 30000;
+ if (System.currentTimeMillis() > startTime + startTimeout) {
+ throw new RuntimeException(String.format("Master not active after %s seconds", startTimeout));
}
}