HBASE-16244 LocalHBaseCluster start timeout should be configurable (Siddharth Wagle)
This commit is contained in:
parent
82ddc931fb
commit
d86f8a4943
|
@ -217,6 +217,8 @@ public class HMasterCommandLine extends ServerCommandLine {
|
||||||
// Run a subclass that does the zk cluster shutdown on its way out.
|
// Run a subclass that does the zk cluster shutdown on its way out.
|
||||||
int mastersCount = conf.getInt("hbase.masters", 1);
|
int mastersCount = conf.getInt("hbase.masters", 1);
|
||||||
int regionServersCount = conf.getInt("hbase.regionservers", 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 +
|
LOG.info("Starting up instance of localHBaseCluster; master=" + mastersCount +
|
||||||
", regionserversCount=" + regionServersCount);
|
", regionserversCount=" + regionServersCount);
|
||||||
LocalHBaseCluster cluster = new LocalHBaseCluster(conf, mastersCount, regionServersCount,
|
LocalHBaseCluster cluster = new LocalHBaseCluster(conf, mastersCount, regionServersCount,
|
||||||
|
|
|
@ -172,11 +172,14 @@ public class JVMClusterUtil {
|
||||||
public static String startup(final List<JVMClusterUtil.MasterThread> masters,
|
public static String startup(final List<JVMClusterUtil.MasterThread> masters,
|
||||||
final List<JVMClusterUtil.RegionServerThread> regionservers) throws IOException {
|
final List<JVMClusterUtil.RegionServerThread> regionservers) throws IOException {
|
||||||
|
|
||||||
|
Configuration configuration = null;
|
||||||
|
|
||||||
if (masters == null || masters.isEmpty()) {
|
if (masters == null || masters.isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (JVMClusterUtil.MasterThread t : masters) {
|
for (JVMClusterUtil.MasterThread t : masters) {
|
||||||
|
configuration = t.getMaster().getConfiguration();
|
||||||
t.start();
|
t.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -190,8 +193,10 @@ public class JVMClusterUtil {
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
throw (InterruptedIOException)new InterruptedIOException().initCause(e);
|
throw (InterruptedIOException)new InterruptedIOException().initCause(e);
|
||||||
}
|
}
|
||||||
if (System.currentTimeMillis() > startTime + 30000) {
|
int startTimeout = configuration != null ? Integer.parseInt(
|
||||||
throw new RuntimeException("Master not active after 30 seconds");
|
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue