Index: hbase-server/src/test/java/org/apache/hadoop/hbase/TestMetaTableLocator.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- hbase-server/src/test/java/org/apache/hadoop/hbase/TestMetaTableLocator.java (revision 0b22eb07bb8ecfa456f170dc9a1dec418ed01e2a) +++ hbase-server/src/test/java/org/apache/hadoop/hbase/TestMetaTableLocator.java (revision ) @@ -218,10 +218,10 @@ Assert.assertFalse(new MetaTableLocator().verifyMetaRegionLocation(connection, watcher, 100)); } - @Test (expected = NotAllMetaRegionsOnlineException.class) + @Test public void testTimeoutWaitForMeta() throws IOException, InterruptedException { - new MetaTableLocator().waitMetaRegionLocation(watcher, 100); + Assert.assertNull(new MetaTableLocator().waitMetaRegionLocation(watcher, 100)); } /** @@ -325,11 +325,7 @@ } void doWaiting() throws InterruptedException { - try { - while (new MetaTableLocator().waitMetaRegionLocation(watcher, 10000) == null); - } catch (NotAllMetaRegionsOnlineException e) { - //Ignore - } + while (new MetaTableLocator().waitMetaRegionLocation(watcher, 100) == null); } } } Index: hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/MetaTableLocator.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/MetaTableLocator.java (revision 0b22eb07bb8ecfa456f170dc9a1dec418ed01e2a) +++ hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/MetaTableLocator.java (revision ) @@ -23,7 +23,6 @@ import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.HRegionInfo; -import org.apache.hadoop.hbase.NotAllMetaRegionsOnlineException; import org.apache.hadoop.hbase.client.HConnection; import org.apache.hadoop.hbase.client.RetriesExhaustedException; import org.apache.hadoop.hbase.exceptions.DeserializationException; @@ -120,7 +119,7 @@ * @throws InterruptedException if interrupted while waiting */ public ServerName waitMetaRegionLocation(ZooKeeperWatcher zkw, long timeout) - throws InterruptedException, NotAllMetaRegionsOnlineException { + throws InterruptedException { try { if (ZKUtil.checkExists(zkw, zkw.baseZNode) == -1) { String errorMsg = "Check the value configured in 'zookeeper.znode.parent'. " @@ -132,11 +131,6 @@ throw new IllegalStateException("KeeperException while trying to check baseZNode:", e); } ServerName sn = blockUntilAvailable(zkw, timeout); - - if (sn == null) { - throw new NotAllMetaRegionsOnlineException("Timed out; " + timeout + "ms"); - } - return sn; } @@ -150,21 +144,18 @@ public void waitMetaRegionLocation(ZooKeeperWatcher zkw) throws InterruptedException { Stopwatch stopwatch = new Stopwatch().start(); while (!stopped) { - try { - if (waitMetaRegionLocation(zkw, 100) != null) break; + if (waitMetaRegionLocation(zkw, 100) != null) break; + if (LOG.isTraceEnabled()) { + LOG.trace("hbase:meta still not available, sleeping and retrying."); + } + - long sleepTime = stopwatch.elapsedMillis(); - // +1 in case sleepTime=0 - if ((sleepTime + 1) % 10000 == 0) { - LOG.warn("Have been waiting for meta to be assigned for " + sleepTime + "ms"); - } + long sleepTime = stopwatch.elapsedMillis(); + // +1 in case sleepTime=0 + if ((sleepTime + 1) % 10000 == 0) { + LOG.warn("Have been waiting for meta to be assigned for " + sleepTime + "ms"); + } - } catch (NotAllMetaRegionsOnlineException e) { - if (LOG.isTraceEnabled()) { - LOG.trace("hbase:meta still not available, sleeping and retrying." + - " Reason: " + e.getMessage()); - } - } + } + } - } - } /** * Verify hbase:meta is deployed and accessible. @@ -180,8 +171,6 @@ AdminProtos.AdminService.BlockingInterface service = null; try { service = getMetaServerConnection(hConnection, zkw, timeout); - } catch (NotAllMetaRegionsOnlineException e) { - // Pass } catch (ServerNotRunningYetException e) { // Pass -- remote server is not up so can't be carrying root } catch (UnknownHostException e) { @@ -248,14 +237,13 @@ * waiting up to the specified timeout for availability. *

WARNING: Does not retry. Use an {@link org.apache.hadoop.hbase.client.HTable} instead. * @param timeout How long to wait on meta location - * @return connection to server hosting meta + * @return connection to server hosting meta, or null, if unable to get meta location * @throws InterruptedException - * @throws NotAllMetaRegionsOnlineException if timed out waiting * @throws IOException */ private AdminService.BlockingInterface getMetaServerConnection(HConnection hConnection, ZooKeeperWatcher zkw, long timeout) - throws InterruptedException, NotAllMetaRegionsOnlineException, IOException { + throws InterruptedException, IOException { return getCachedConnection(hConnection, waitMetaRegionLocation(zkw, timeout)); }