Author: jxiang
Date: Tue Apr 15 21:12:23 2014
New Revision: 1587733
URL: http://svn.apache.org/r1587733
Log:
HBASE-10976 Start CatalogTracker after cluster ID is available
Modified:
hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
Modified:
hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
URL:
http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java?rev=1587733&r1=1587732&r2=1587733&view=diff
==============================================================================
---
hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
(original)
+++
hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
Tue Apr 15 21:12:23 2014
@@ -472,6 +472,9 @@ public class HMaster extends HRegionServ
ZKClusterId.setClusterId(this.zooKeeper, fileSystemManager.getClusterId());
this.serverManager = createServerManager(this, this);
+ // Now we have the cluster ID, start catalog tracker
+ startCatalogTracker();
+
// Invalidate all write locks held previously
this.tableLockManager.reapWriteLocks();
Modified:
hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
URL:
http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java?rev=1587733&r1=1587732&r2=1587733&view=diff
==============================================================================
---
hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
(original)
+++
hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
Tue Apr 15 21:12:23 2014
@@ -468,18 +468,15 @@ public class HRegionServer extends HasTh
// Open connection to zookeeper and set primary watcher
zooKeeper = new ZooKeeperWatcher(conf, getProcessName() + ":" +
rpcServices.isa.getPort(), this, canCreateBaseZNode());
-
+
tableLockManager = TableLockManager.createTableLockManager(
conf, zooKeeper, serverName);
-
+
masterAddressTracker = new MasterAddressTracker(getZooKeeper(), this);
masterAddressTracker.start();
-
+
clusterStatusTracker = new ClusterStatusTracker(zooKeeper, this);
clusterStatusTracker.start();
-
- catalogTracker = createCatalogTracker();
- catalogTracker.start();
}
rpcServices.start();
@@ -602,6 +599,9 @@ public class HRegionServer extends HasTh
this.abort("Failed to retrieve Cluster ID",e);
}
+ // Now we have the cluster ID, start catalog tracker
+ startCatalogTracker();
+
// watch for snapshots and other procedures
try {
rspmHost = new RegionServerProcedureManagerHost();
@@ -675,6 +675,17 @@ public class HRegionServer extends HasTh
}
/**
+ * Create and start the catalog tracker if not already done.
+ */
+ protected synchronized void startCatalogTracker()
+ throws IOException, InterruptedException {
+ if (catalogTracker == null) {
+ catalogTracker = createCatalogTracker();
+ catalogTracker.start();
+ }
+ }
+
+ /**
* The HRegionServer sticks in this loop until closed.
*/
@Override