当前位置: 首页>>代码示例>>Java>>正文


Java NotAllMetaRegionsOnlineException类代码示例

本文整理汇总了Java中org.apache.hadoop.hbase.NotAllMetaRegionsOnlineException的典型用法代码示例。如果您正苦于以下问题:Java NotAllMetaRegionsOnlineException类的具体用法?Java NotAllMetaRegionsOnlineException怎么用?Java NotAllMetaRegionsOnlineException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


NotAllMetaRegionsOnlineException类属于org.apache.hadoop.hbase包,在下文中一共展示了NotAllMetaRegionsOnlineException类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: waitMetaRegionLocation

import org.apache.hadoop.hbase.NotAllMetaRegionsOnlineException; //导入依赖的package包/类
/**
 * 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
 * @param replicaId
 * @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
 * @throws NotAllMetaRegionsOnlineException
 */
public ServerName waitMetaRegionLocation(ZooKeeperWatcher zkw, int replicaId, long timeout)
throws InterruptedException, NotAllMetaRegionsOnlineException {
  try {
    if (ZKUtil.checkExists(zkw, zkw.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;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:34,代码来源:MetaTableLocator.java

示例2: waitForMeta

import org.apache.hadoop.hbase.NotAllMetaRegionsOnlineException; //导入依赖的package包/类
/**
 * Gets the current location for <code>.META.</code> if available and waits
 * for up to the specified timeout if not immediately available.  Throws an
 * exception if timed out waiting.  This method differs from {@link #waitForMeta()}
 * in that it will go ahead and verify the location gotten from ZooKeeper and
 * -ROOT- region by trying to use returned connection.
 * @param timeout maximum time to wait for meta availability, in milliseconds
 * @return {@link ServerName} for server hosting <code>.META.</code> or null
 * if none available
 * @throws InterruptedException if interrupted while waiting
 * @throws IOException unexpected exception connecting to meta server
 * @throws NotAllMetaRegionsOnlineException if meta not available before
 * timeout
 */
public ServerName waitForMeta(long timeout)
throws InterruptedException, IOException, NotAllMetaRegionsOnlineException {
  long stop = timeout == 0 ? Long.MAX_VALUE : System.currentTimeMillis() + timeout;
  long waitTime = Math.min(50, timeout);
  synchronized (metaAvailable) {
    while(!stopped && System.currentTimeMillis() < stop) {
      if (getMetaServerConnection() != null) {
        return metaLocation;
      }
      // perhaps -ROOT- region isn't available, let us wait a bit and retry.
      metaAvailable.wait(waitTime);
    }
    if (getMetaServerConnection() == null) {
      throw new NotAllMetaRegionsOnlineException("Timed out (" + timeout + "ms)");
    }
    return metaLocation;
  }
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:33,代码来源:CatalogTracker.java

示例3: offlineParentInMeta

import org.apache.hadoop.hbase.NotAllMetaRegionsOnlineException; //导入依赖的package包/类
/**
 * Offline parent in meta.
 * Used when splitting.
 * @param catalogTracker
 * @param parent
 * @param a Split daughter region A
 * @param b Split daughter region B
 * @throws NotAllMetaRegionsOnlineException
 * @throws IOException
 */
public static void offlineParentInMeta(CatalogTracker catalogTracker,
    HRegionInfo parent, final HRegionInfo a, final HRegionInfo b)
throws NotAllMetaRegionsOnlineException, IOException {
  HRegionInfo copyOfParent = new HRegionInfo(parent);
  copyOfParent.setOffline(true);
  copyOfParent.setSplit(true);
  Put put = new Put(copyOfParent.getRegionName());
  addRegionInfo(put, copyOfParent);
  put.add(HConstants.CATALOG_FAMILY, HConstants.SPLITA_QUALIFIER,
    Writables.getBytes(a));
  put.add(HConstants.CATALOG_FAMILY, HConstants.SPLITB_QUALIFIER,
    Writables.getBytes(b));
  putToMetaTable(catalogTracker, put);
  LOG.info("Offlined parent region " + parent.getRegionNameAsString() +
    " in META");
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:27,代码来源:MetaEditor.java

示例4: CloneSnapshotHandler

import org.apache.hadoop.hbase.NotAllMetaRegionsOnlineException; //导入依赖的package包/类
public CloneSnapshotHandler(final MasterServices masterServices,
    final SnapshotDescription snapshot, final HTableDescriptor hTableDescriptor,
    final MasterMetrics metricsMaster)
    throws NotAllMetaRegionsOnlineException, TableExistsException, IOException {
  super(masterServices, masterServices.getMasterFileSystem(),
    masterServices.getServerManager(), hTableDescriptor,
    masterServices.getConfiguration(), null, masterServices.getCatalogTracker(),
    masterServices.getAssignmentManager());
  this.metricsMaster = metricsMaster;

  // Snapshot information
  this.snapshot = snapshot;

  // Monitor
  this.monitor = new ForeignExceptionDispatcher();
  this.status = TaskMonitor.get().createStatus("Cloning  snapshot '" + snapshot.getName() +
    "' to table " + hTableDescriptor.getNameAsString());
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:19,代码来源:CloneSnapshotHandler.java

示例5: MockServer

import org.apache.hadoop.hbase.NotAllMetaRegionsOnlineException; //导入依赖的package包/类
MockServer(final HBaseTestingUtility htu)
throws NotAllMetaRegionsOnlineException, IOException, InterruptedException {
  this.c = htu.getConfiguration();
  // Mock an HConnection and a HRegionInterface implementation.  Have the
  // HConnection return the HRI.  Have the HRI return a few mocked up responses
  // to make our test work.
  this.connection =
    HConnectionTestingUtility.getMockedConnectionAndDecorate(this.c,
      Mockito.mock(HRegionInterface.class),
      new ServerName("example.org,12345,6789"),
      HRegionInfo.FIRST_META_REGIONINFO);
  // Set hbase.rootdir into test dir.
  FileSystem fs = FileSystem.get(this.c);
  Path rootdir = fs.makeQualified(new Path(this.c.get(HConstants.HBASE_DIR)));
  this.c.set(HConstants.HBASE_DIR, rootdir.toString());
  this.ct = Mockito.mock(CatalogTracker.class);
  HRegionInterface hri = Mockito.mock(HRegionInterface.class);
  Mockito.when(this.ct.getConnection()).thenReturn(this.connection);
  Mockito.when(ct.waitForMetaServerConnection(Mockito.anyLong())).thenReturn(hri);
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:21,代码来源:TestCatalogJanitor.java

示例6: waitMetaRegionLocation

import org.apache.hadoop.hbase.NotAllMetaRegionsOnlineException; //导入依赖的package包/类
/**
 * 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 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 interrupted while waiting
 */
public ServerName waitMetaRegionLocation(ZooKeeperWatcher zkw, long timeout)
throws InterruptedException, NotAllMetaRegionsOnlineException {
  try {
    if (ZKUtil.checkExists(zkw, zkw.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, timeout);

  if (sn == null) {
    throw new NotAllMetaRegionsOnlineException("Timed out; " + timeout + "ms");
  }

  return sn;
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:31,代码来源:MetaTableLocator.java

示例7: waitForMeta

import org.apache.hadoop.hbase.NotAllMetaRegionsOnlineException; //导入依赖的package包/类
/**
 * Waits indefinitely for availability of <code>hbase:meta</code>.  Used during
 * cluster startup.  Does not verify meta, just that something has been
 * set up in zk.
 * @see #waitForMeta(long)
 * @throws InterruptedException if interrupted while waiting
 */
public void waitForMeta() throws InterruptedException {
  Stopwatch stopwatch = new Stopwatch().start();
  while (!this.stopped) {
    try {
      if (waitForMeta(100) != null) break;
      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());
      }
    }
  }
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:26,代码来源:CatalogTracker.java

示例8: testGuavaConflict

import org.apache.hadoop.hbase.NotAllMetaRegionsOnlineException; //导入依赖的package包/类
/**
 * Ensure Armeria's dependencies do not cause a trouble with hbase-shaded-client.
 *
 * @see <a href="https://issues.apache.org/jira/browse/HBASE-14963">HBASE-14963</a>
 */
@Test(expected = NotAllMetaRegionsOnlineException.class)
public void testGuavaConflict() throws Exception {
    // Make sure Armeria is available in the class path.
    assertThat(Version.identify(Server.class.getClassLoader())).isNotNull();
    // Make sure newer Guava is available in the class path.
    assertThat(Stopwatch.class.getDeclaredConstructor().getModifiers()).is(new Condition<>(
            value -> !Modifier.isPublic(value),
            "Recent Guava Stopwatch should have non-public default constructor."));

    final MetaTableLocator locator = new MetaTableLocator();
    final ZooKeeperWatcher zkw = mock(ZooKeeperWatcher.class);
    final RecoverableZooKeeper zk = mock(RecoverableZooKeeper.class);
    when(zkw.getRecoverableZooKeeper()).thenReturn(zk);
    when(zk.exists(any(), any())).thenReturn(new Stat(0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0));

    locator.waitMetaRegionLocation(zkw, 100);
}
 
开发者ID:line,项目名称:armeria,代码行数:23,代码来源:HBaseClientCompatibilityTest.java

示例9: waitMetaRegionLocation

import org.apache.hadoop.hbase.NotAllMetaRegionsOnlineException; //导入依赖的package包/类
/**
 * 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 ServerName waitMetaRegionLocation(ZKWatcher zkw, int replicaId, long timeout)
throws InterruptedException, NotAllMetaRegionsOnlineException {
  try {
    if (ZKUtil.checkExists(zkw, zkw.znodePaths.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;
}
 
开发者ID:apache,项目名称:hbase,代码行数:34,代码来源:MetaTableLocator.java

示例10: waitForMeta

import org.apache.hadoop.hbase.NotAllMetaRegionsOnlineException; //导入依赖的package包/类
/**
 * Gets the current location for <code>.META.</code> if available and waits
 * for up to the specified timeout if not immediately available.  Throws an
 * exception if timed out waiting.  This method differs from {@link #waitForMeta()}
 * in that it will go ahead and verify the location gotten from ZooKeeper and
 * -ROOT- region by trying to use returned connection.
 * @param timeout maximum time to wait for meta availability, in milliseconds
 * @return {@link ServerName} for server hosting <code>.META.</code> or null
 * if none available
 * @throws InterruptedException if interrupted while waiting
 * @throws IOException unexpected exception connecting to meta server
 * @throws NotAllMetaRegionsOnlineException if meta not available before
 * timeout
 */
public ServerName waitForMeta(long timeout)
throws InterruptedException, IOException, NotAllMetaRegionsOnlineException {
  long stop = System.currentTimeMillis() + timeout;
  long waitTime = Math.min(50, timeout);
  synchronized (metaAvailable) {
    while(!stopped && (timeout == 0 || System.currentTimeMillis() < stop)) {
      if (getMetaServerConnection() != null) {
        return metaLocation;
      }
      // perhaps -ROOT- region isn't available, let us wait a bit and retry.
      metaAvailable.wait(waitTime);
    }
    if (getMetaServerConnection() == null) {
      throw new NotAllMetaRegionsOnlineException("Timed out (" + timeout + "ms)");
    }
    return metaLocation;
  }
}
 
开发者ID:lifeng5042,项目名称:RStore,代码行数:33,代码来源:CatalogTracker.java

示例11: offlineParentInMeta

import org.apache.hadoop.hbase.NotAllMetaRegionsOnlineException; //导入依赖的package包/类
/**
 * Offline parent in meta.
 * Used when splitting.
 * @param catalogTracker
 * @param parent
 * @param a Split daughter region A
 * @param b Split daughter region B
 * @throws NotAllMetaRegionsOnlineException
 * @throws IOException
 */
public static void offlineParentInMeta(CatalogTracker catalogTracker,
    HRegionInfo parent, final HRegionInfo a, final HRegionInfo b)
throws NotAllMetaRegionsOnlineException, IOException {
  HRegionInfo copyOfParent = new HRegionInfo(parent);
  copyOfParent.setOffline(true);
  copyOfParent.setSplit(true);
  HTable meta = MetaReader.getMetaHTable(catalogTracker);
  try {
    addRegionToMeta(meta, copyOfParent, a, b);
    LOG.info("Offlined parent region " + parent.getRegionNameAsString() +
        " in META");
  } finally {
    meta.close();
  }
}
 
开发者ID:daidong,项目名称:DominoHBase,代码行数:26,代码来源:MetaEditor.java

示例12: waitMetaRegions

import org.apache.hadoop.hbase.NotAllMetaRegionsOnlineException; //导入依赖的package包/类
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);
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:12,代码来源:ProcedureSyncWait.java

示例13: addDaughter

import org.apache.hadoop.hbase.NotAllMetaRegionsOnlineException; //导入依赖的package包/类
public static void addDaughter(final CatalogTracker catalogTracker,
    final HRegionInfo regionInfo, final ServerName sn)
throws NotAllMetaRegionsOnlineException, IOException {
  Put put = new Put(regionInfo.getRegionName());
  addRegionInfo(put, regionInfo);
  if (sn != null) addLocation(put, sn);
  putToMetaTable(catalogTracker, put);
  LOG.info("Added daughter " + regionInfo.getRegionNameAsString() +
    (sn == null? ", serverName=null": ", serverName=" + sn.toString()));
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:11,代码来源:MetaEditor.java

示例14: addDaughter

import org.apache.hadoop.hbase.NotAllMetaRegionsOnlineException; //导入依赖的package包/类
/**
 * Adds a daughter region entry to meta.
 * @param regionInfo the region to put
 * @param sn the location of the region
 * @param openSeqNum the latest sequence number obtained when the region was open
 */
public static void addDaughter(final CatalogTracker catalogTracker,
    final HRegionInfo regionInfo, final ServerName sn, final long openSeqNum)
throws NotAllMetaRegionsOnlineException, IOException {
  Put put = new Put(regionInfo.getRegionName());
  addRegionInfo(put, regionInfo);
  if (sn != null) {
    addLocation(put, sn, openSeqNum);
  }
  putToMetaTable(catalogTracker, put);
  LOG.info("Added daughter " + regionInfo.getEncodedName() +
    (sn == null? ", serverName=null": ", serverName=" + sn.toString()));
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:19,代码来源:MetaEditor.java


注:本文中的org.apache.hadoop.hbase.NotAllMetaRegionsOnlineException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。