You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by st...@apache.org on 2014/10/30 05:42:40 UTC

git commit: HBASE-12238 A few ugly exceptions on startup

Repository: hbase
Updated Branches:
  refs/heads/master 842a77e4a -> 5062edebc


HBASE-12238 A few ugly exceptions on startup


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/5062edeb
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/5062edeb
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/5062edeb

Branch: refs/heads/master
Commit: 5062edebcfc18329360845988cfee5d25c23a934
Parents: 842a77e
Author: stack <st...@apache.org>
Authored: Wed Oct 29 21:42:29 2014 -0700
Committer: stack <st...@apache.org>
Committed: Wed Oct 29 21:42:29 2014 -0700

----------------------------------------------------------------------
 .../hadoop/hbase/zookeeper/MetaTableLocator.java   |  8 ++++----
 .../org/apache/hadoop/hbase/master/HMaster.java    |  9 ++++++---
 .../hadoop/hbase/master/HMasterCommandLine.java    | 17 +++++++++++------
 .../hbase/zookeeper/MiniZooKeeperCluster.java      |  8 ++++----
 4 files changed, 25 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/5062edeb/hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/MetaTableLocator.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/MetaTableLocator.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/MetaTableLocator.java
index 6e185d2..4a4dcd8 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/MetaTableLocator.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/MetaTableLocator.java
@@ -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;
   }
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/5062edeb/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 507d31d..6bbff40 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
@@ -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

http://git-wip-us.apache.org/repos/asf/hbase/blob/5062edeb/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 d01e618..f1606f1 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
@@ -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);

http://git-wip-us.apache.org/repos/asf/hbase/blob/5062edeb/hbase-server/src/main/java/org/apache/hadoop/hbase/zookeeper/MiniZooKeeperCluster.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/zookeeper/MiniZooKeeperCluster.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/zookeeper/MiniZooKeeperCluster.java
index 8d8d210..e3ac47e 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/zookeeper/MiniZooKeeperCluster.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/zookeeper/MiniZooKeeperCluster.java
@@ -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;
   }