protected static void waitMetaRegions(final MasterProcedureEnv env) throws IOException { int timeout = env.getMasterConfiguration().getInt("hbase.client.catalog.timeout", 10000); try { if (MetaTableLocator.waitMetaRegionLocation(env.getMasterServices().getZooKeeper(), timeout) == null) { throw new NotAllMetaRegionsOnlineException(); } } catch (InterruptedException e) { throw (InterruptedIOException) new InterruptedIOException().initCause(e); } }
/** * Gets the meta region location, if available, and waits for up to the specified timeout if not * immediately available. Given the zookeeper notification could be delayed, we will try to get * the latest data. * @param zkw reference to the {@link ZKWatcher} which also contains configuration and operation * @param replicaId the ID of the replica * @param timeout maximum time to wait, in millis * @return server name for server hosting meta region formatted as per {@link ServerName}, or null * if none available * @throws InterruptedException if waiting for the socket operation fails * @throws NotAllMetaRegionsOnlineException if a meta or root region is not online */ public static ServerName waitMetaRegionLocation(ZKWatcher zkw, int replicaId, long timeout) throws InterruptedException, NotAllMetaRegionsOnlineException { try { if (ZKUtil.checkExists(zkw, zkw.getZNodePaths().baseZNode) == -1) { String errorMsg = "Check the value configured in 'zookeeper.znode.parent'. " + "There could be a mismatch with the one configured in the master."; LOG.error(errorMsg); throw new IllegalArgumentException(errorMsg); } } catch (KeeperException e) { throw new IllegalStateException("KeeperException while trying to check baseZNode:", e); } ServerName sn = blockUntilAvailable(zkw, replicaId, timeout); if (sn == null) { throw new NotAllMetaRegionsOnlineException("Timed out; " + timeout + "ms"); } return sn; }
/** * Gets the current location for <code>-ROOT-</code> if available and waits * for up to the specified timeout if not immediately available. Returns null * if the timeout elapses before root is available. * @param timeout maximum time to wait for root availability, in milliseconds * @return {@link ServerName} for server hosting <code>-ROOT-</code> or null * if none available * @throws InterruptedException if interrupted while waiting * @throws NotAllMetaRegionsOnlineException if root not available before * timeout */ ServerName waitForRoot(final long timeout) throws InterruptedException, NotAllMetaRegionsOnlineException { ServerName sn = rootRegionTracker.waitRootRegionLocation(timeout); if (sn == null) { throw new NotAllMetaRegionsOnlineException("Timed out; " + timeout + "ms"); } return sn; }
throw new NotAllMetaRegionsOnlineException("Timed out (" + timeout + "ms)");
protected static void waitMetaRegions(final MasterProcedureEnv env) throws IOException { int timeout = env.getMasterConfiguration().getInt("hbase.client.catalog.timeout", 10000); try { if (env.getMasterServices().getMetaTableLocator().waitMetaRegionLocation( env.getMasterServices().getZooKeeper(), timeout) == null) { throw new NotAllMetaRegionsOnlineException(); } } catch (InterruptedException e) { throw (InterruptedIOException)new InterruptedIOException().initCause(e); } }
throw new NotAllMetaRegionsOnlineException("Timed out; " + timeout + "ms");
throw new NotAllMetaRegionsOnlineException("Timed out; " + timeout + "ms");
if (server.getMetaTableLocator().waitMetaRegionLocation( server.getZooKeeper(), timeout) == null) { throw new NotAllMetaRegionsOnlineException();