HBASE-10976 Start CatalogTracker after cluster ID is available

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1587733 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
jxiang 2014-04-15 21:12:23 +00:00
parent 6af961c0d3
commit 9f874d4d09
2 changed files with 20 additions and 6 deletions

View File

@ -472,6 +472,9 @@ public class HMaster extends HRegionServer implements MasterServices, Server {
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();

View File

@ -468,18 +468,15 @@ public class HRegionServer extends HasThread implements
// 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 HasThread implements
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();
@ -674,6 +674,17 @@ public class HRegionServer extends HasThread implements
pauseMonitor.start();
}
/**
* 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.
*/