Index: src/main/java/org/apache/hadoop/hbase/catalog/CatalogTracker.java =================================================================== --- src/main/java/org/apache/hadoop/hbase/catalog/CatalogTracker.java (revision 1434117) +++ src/main/java/org/apache/hadoop/hbase/catalog/CatalogTracker.java (working copy) @@ -118,11 +118,6 @@ */ private ServerName metaLocation; - /* - * Timeout waiting on root or meta to be set. - */ - private final int defaultTimeout; - private boolean stopped = false; static final byte [] ROOT_REGION_NAME = @@ -158,33 +153,13 @@ * @throws IOException */ public CatalogTracker(final ZooKeeperWatcher zk, final Configuration conf, - final Abortable abortable) + Abortable abortable) throws IOException { - this(zk, conf, abortable, - conf.getInt("hbase.catalogtracker.default.timeout", 1000)); + this(zk, conf, HConnectionManager.getConnection(conf), abortable); } - /** - * Constructs the catalog tracker. Find current state of catalog tables. - * Begin active tracking by executing {@link #start()} post construction. - * @param zk If zk is null, we'll create an instance (and shut it down - * when {@link #stop()} is called) else we'll use what is passed. - * @param conf - * @param abortable If fatal exception we'll call abort on this. May be null. - * If it is we'll use the Connection associated with the passed - * {@link Configuration} as our Abortable. - * @param defaultTimeout Timeout to use. Pass zero for no timeout - * ({@link Object#wait(long)} when passed a 0 waits for ever). - * @throws IOException - */ - public CatalogTracker(final ZooKeeperWatcher zk, final Configuration conf, - Abortable abortable, final int defaultTimeout) - throws IOException { - this(zk, conf, HConnectionManager.getConnection(conf), abortable, defaultTimeout); - } - CatalogTracker(final ZooKeeperWatcher zk, final Configuration conf, - HConnection connection, Abortable abortable, final int defaultTimeout) + HConnection connection, Abortable abortable) throws IOException { this.connection = connection; if (abortable == null) { @@ -222,7 +197,6 @@ ct.resetMetaLocation(); } }; - this.defaultTimeout = defaultTimeout; } /** @@ -370,24 +344,6 @@ } /** - * Gets a connection to the server hosting root, as reported by ZooKeeper, - * waiting for the default timeout specified on instantiation. - * @see #waitForRoot(long) for additional information - * @return connection to server hosting root - * @throws NotAllMetaRegionsOnlineException if timed out waiting - * @throws IOException - * @deprecated Use #getRootServerConnection(long) - */ - public HRegionInterface waitForRootServerConnectionDefault() - throws NotAllMetaRegionsOnlineException, IOException { - try { - return getRootServerConnection(this.defaultTimeout); - } catch (InterruptedException e) { - throw new NotAllMetaRegionsOnlineException("Interrupted"); - } - } - - /** * Gets a connection to the server currently hosting .META. or * null if location is not currently available. *

@@ -476,10 +432,10 @@ */ public ServerName waitForMeta(long timeout) throws InterruptedException, IOException, NotAllMetaRegionsOnlineException { - long stop = System.currentTimeMillis() + timeout; + long stop = timeout == 0 ? Long.MAX_VALUE : System.currentTimeMillis() + timeout; long waitTime = Math.min(50, timeout); synchronized (metaAvailable) { - while(!stopped && (timeout == 0 || System.currentTimeMillis() < stop)) { + while(!stopped && System.currentTimeMillis() < stop) { if (getMetaServerConnection() != null) { return metaLocation; } @@ -509,25 +465,6 @@ } /** - * Gets a connection to the server hosting meta, as reported by ZooKeeper, - * waiting up to the specified timeout for availability. - * Used in tests. - * @see #waitForMeta(long) for additional information - * @return connection to server hosting meta - * @throws NotAllMetaRegionsOnlineException if timed out or interrupted - * @throws IOException - * @deprecated Does not retry; use an HTable instance instead. - */ - public HRegionInterface waitForMetaServerConnectionDefault() - throws NotAllMetaRegionsOnlineException, IOException { - try { - return getCachedConnection(waitForMeta(defaultTimeout)); - } catch (InterruptedException e) { - throw new NotAllMetaRegionsOnlineException("Interrupted"); - } - } - - /** * Called when we figure current meta is off (called from zk callback). */ public void resetMetaLocation() { Index: src/main/java/org/apache/hadoop/hbase/master/HMaster.java =================================================================== --- src/main/java/org/apache/hadoop/hbase/master/HMaster.java (revision 1434117) +++ src/main/java/org/apache/hadoop/hbase/master/HMaster.java (working copy) @@ -441,8 +441,7 @@ */ private void initializeZKBasedSystemTrackers() throws IOException, InterruptedException, KeeperException { - this.catalogTracker = new CatalogTracker(this.zooKeeper, this.conf, - this, conf.getInt("hbase.master.catalog.timeout", Integer.MAX_VALUE)); + this.catalogTracker = new CatalogTracker(this.zooKeeper, this.conf, this); this.catalogTracker.start(); this.balancer = LoadBalancerFactory.getLoadBalancer(conf); Index: src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java =================================================================== --- src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java (revision 1434117) +++ src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java (working copy) @@ -622,8 +622,7 @@ blockAndCheckIfStopped(this.clusterStatusTracker); // Create the catalog tracker and start it; - this.catalogTracker = new CatalogTracker(this.zooKeeper, this.conf, - this, this.conf.getInt("hbase.regionserver.catalog.timeout", Integer.MAX_VALUE)); + this.catalogTracker = new CatalogTracker(this.zooKeeper, this.conf, this); catalogTracker.start(); } Index: src/test/java/org/apache/hadoop/hbase/catalog/TestCatalogTracker.java =================================================================== --- src/test/java/org/apache/hadoop/hbase/catalog/TestCatalogTracker.java (revision 1434117) +++ src/test/java/org/apache/hadoop/hbase/catalog/TestCatalogTracker.java (working copy) @@ -103,7 +103,7 @@ private CatalogTracker constructAndStartCatalogTracker(final HConnection c) throws IOException, InterruptedException { CatalogTracker ct = new CatalogTracker(this.watcher, UTIL.getConfiguration(), - c, this.abortable, 0); + c, this.abortable); ct.start(); return ct; } @@ -213,11 +213,9 @@ @Override public void run() { try { - metaSet.set(ct.waitForMetaServerConnectionDefault() != null); - } catch (NotAllMetaRegionsOnlineException e) { + metaSet.set(ct.waitForMetaServerConnection(100000) != null); + } catch (Exception e) { throw new RuntimeException(e); - } catch (IOException e) { - throw new RuntimeException(e); } } }; Index: src/test/java/org/apache/hadoop/hbase/catalog/TestMetaReaderEditorNoCluster.java =================================================================== --- src/test/java/org/apache/hadoop/hbase/catalog/TestMetaReaderEditorNoCluster.java (revision 1434117) +++ src/test/java/org/apache/hadoop/hbase/catalog/TestMetaReaderEditorNoCluster.java (working copy) @@ -153,7 +153,7 @@ when(connection).getHRegionConnection(Mockito.anyString(), Mockito.anyInt()); // Now start up the catalogtracker with our doctored Connection. - ct = new CatalogTracker(zkw, null, connection, ABORTABLE, 0); + ct = new CatalogTracker(zkw, null, connection, ABORTABLE); ct.start(); // Scan meta for user tables and verify we got back expected answer. NavigableMap hris = MetaReader.getServerUserRegions(ct, sn); Index: src/test/java/org/apache/hadoop/hbase/master/TestCatalogJanitor.java =================================================================== --- src/test/java/org/apache/hadoop/hbase/master/TestCatalogJanitor.java (revision 1434117) +++ src/test/java/org/apache/hadoop/hbase/master/TestCatalogJanitor.java (working copy) @@ -101,7 +101,7 @@ this.ct = Mockito.mock(CatalogTracker.class); HRegionInterface hri = Mockito.mock(HRegionInterface.class); Mockito.when(this.ct.getConnection()).thenReturn(this.connection); - Mockito.when(ct.waitForMetaServerConnectionDefault()).thenReturn(hri); + Mockito.when(ct.waitForMetaServerConnection(Mockito.anyLong())).thenReturn(hri); } @Override