HBASE-12238 A few ugly exceptions on startup
This commit is contained in:
parent
842a77e4a5
commit
5062edebcf
|
@ -96,8 +96,8 @@ public class MetaTableLocator {
|
|||
*/
|
||||
public List<Pair<HRegionInfo, ServerName>> getMetaRegionsAndLocations(ZooKeeperWatcher zkw) {
|
||||
ServerName serverName = new MetaTableLocator().getMetaRegionLocation(zkw);
|
||||
List<Pair<HRegionInfo, ServerName>> list = new ArrayList<>();
|
||||
list.add(new Pair<>(HRegionInfo.FIRST_META_REGIONINFO, serverName));
|
||||
List<Pair<HRegionInfo, ServerName>> list = new ArrayList<Pair<HRegionInfo, ServerName>>();
|
||||
list.add(new Pair<HRegionInfo, ServerName>(HRegionInfo.FIRST_META_REGIONINFO, serverName));
|
||||
return list;
|
||||
}
|
||||
|
||||
|
@ -114,7 +114,7 @@ public class MetaTableLocator {
|
|||
private List<HRegionInfo> getListOfHRegionInfos(
|
||||
final List<Pair<HRegionInfo, ServerName>> pairs) {
|
||||
if (pairs == null || pairs.isEmpty()) return null;
|
||||
List<HRegionInfo> result = new ArrayList<>(pairs.size());
|
||||
List<HRegionInfo> result = new ArrayList<HRegionInfo>(pairs.size());
|
||||
for (Pair<HRegionInfo, ServerName> pair: pairs) {
|
||||
result.add(pair.getFirst());
|
||||
}
|
||||
|
@ -265,7 +265,7 @@ public class MetaTableLocator {
|
|||
}
|
||||
}
|
||||
LOG.info("Failed verification of " + Bytes.toStringBinary(regionName) +
|
||||
" at address=" + address + ", exception=" + t);
|
||||
" at address=" + address + ", exception=" + t.getMessage());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -262,7 +262,7 @@ public class HMaster extends HRegionServer implements MasterServices, Server {
|
|||
* </ol>
|
||||
* <p>
|
||||
* Remaining steps of initialization occur in
|
||||
* {@link #finishActiveMasterInitialization(MonitoredTask)} after
|
||||
* #finishActiveMasterInitialization(MonitoredTask) after
|
||||
* the master becomes the active one.
|
||||
*
|
||||
* @throws KeeperException
|
||||
|
@ -291,6 +291,7 @@ public class HMaster extends HRegionServer implements MasterServices, Server {
|
|||
this.metricsMaster = new MetricsMaster( new MetricsMasterWrapperImpl(this));
|
||||
|
||||
// Do we publish the status?
|
||||
|
||||
boolean shouldPublish = conf.getBoolean(HConstants.STATUS_PUBLISHED,
|
||||
HConstants.STATUS_PUBLISHED_DEFAULT);
|
||||
Class<? extends ClusterStatusPublisher.Publisher> publisherClass =
|
||||
|
@ -1267,8 +1268,10 @@ public class HMaster extends HRegionServer implements MasterServices, Server {
|
|||
* this node explicitly. If we crash before then, ZooKeeper will delete
|
||||
* this node for us since it is ephemeral.
|
||||
*/
|
||||
LOG.info("Adding ZNode for " + backupZNode + " in backup master directory");
|
||||
MasterAddressTracker.setMasterAddress(zooKeeper, backupZNode, serverName);
|
||||
LOG.info("Adding backup master ZNode " + backupZNode);
|
||||
if (!MasterAddressTracker.setMasterAddress(zooKeeper, backupZNode, serverName)) {
|
||||
LOG.warn("Failed create of " + backupZNode + " by " + serverName);
|
||||
}
|
||||
|
||||
activeMasterManager = new ActiveMasterManager(zooKeeper, serverName, this);
|
||||
// Start a thread to try to become the active master, so we won't block here
|
||||
|
|
|
@ -166,7 +166,10 @@ public class HMasterCommandLine extends ServerCommandLine {
|
|||
// login the zookeeper server principal (if using security)
|
||||
ZKUtil.loginServer(conf, "hbase.zookeeper.server.keytab.file",
|
||||
"hbase.zookeeper.server.kerberos.principal", null);
|
||||
|
||||
int localZKClusterSessionTimeout =
|
||||
conf.getInt(HConstants.ZK_SESSION_TIMEOUT + ".localHBaseCluster", 10*1000);
|
||||
conf.setInt(HConstants.ZK_SESSION_TIMEOUT, localZKClusterSessionTimeout);
|
||||
LOG.info("Starting a zookeeper cluster");
|
||||
int clientPort = zooKeeperCluster.startup(zkDataPath);
|
||||
if (clientPort != zkClientPort) {
|
||||
String errorMsg = "Could not start ZK at requested port of " +
|
||||
|
@ -176,13 +179,15 @@ public class HMasterCommandLine extends ServerCommandLine {
|
|||
System.err.println(errorMsg);
|
||||
throw new IOException(errorMsg);
|
||||
}
|
||||
conf.set(HConstants.ZOOKEEPER_CLIENT_PORT,
|
||||
Integer.toString(clientPort));
|
||||
conf.setInt(HConstants.ZK_SESSION_TIMEOUT, 10 *1000);
|
||||
conf.set(HConstants.ZOOKEEPER_CLIENT_PORT, Integer.toString(clientPort));
|
||||
// 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);
|
||||
int mastersCount = conf.getInt("hbase.masters", 1);
|
||||
int regionServersCount = conf.getInt("hbase.regionservers", 1);
|
||||
LOG.info("Starting up instance of localHBaseCluster; master=" + mastersCount +
|
||||
", regionserversCount=" + regionServersCount);
|
||||
LocalHBaseCluster cluster = new LocalHBaseCluster(conf, mastersCount, regionServersCount,
|
||||
LocalHMaster.class, HRegionServer.class);
|
||||
((LocalHMaster)cluster.getMaster(0)).setZKCluster(zooKeeperCluster);
|
||||
cluster.startup();
|
||||
waitOnMasterThreads(cluster);
|
||||
|
|
|
@ -165,8 +165,7 @@ public class MiniZooKeeperCluster {
|
|||
standaloneServerFactory = new NIOServerCnxnFactory();
|
||||
standaloneServerFactory.configure(
|
||||
new InetSocketAddress(tentativePort),
|
||||
configuration.getInt(HConstants.ZOOKEEPER_MAX_CLIENT_CNXNS,
|
||||
1000));
|
||||
configuration.getInt(HConstants.ZOOKEEPER_MAX_CLIENT_CNXNS, 1000));
|
||||
} catch (BindException e) {
|
||||
LOG.debug("Failed binding ZK Server to client port: " +
|
||||
tentativePort, e);
|
||||
|
@ -181,6 +180,7 @@ public class MiniZooKeeperCluster {
|
|||
|
||||
// Start up this ZK server
|
||||
standaloneServerFactory.startup(server);
|
||||
// Runs a 'stat' against the servers.
|
||||
if (!waitForServerUp(tentativePort, CONNECTION_TIMEOUT)) {
|
||||
throw new IOException("Waiting for startup of standalone server");
|
||||
}
|
||||
|
@ -196,8 +196,8 @@ public class MiniZooKeeperCluster {
|
|||
activeZKServerIndex = 0;
|
||||
started = true;
|
||||
int clientPort = clientPortList.get(activeZKServerIndex);
|
||||
LOG.info("Started MiniZK Cluster and connect 1 ZK server " +
|
||||
"on client port: " + clientPort);
|
||||
LOG.info("Started MiniZooKeeperCluster and ran successful 'stat' " +
|
||||
"on client port=" + clientPort);
|
||||
return clientPort;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue