Java Code Examples for org.apache.hadoop.hbase.zookeeper.MetaTableLocator#waitMetaRegionLocation()

The following examples show how to use org.apache.hadoop.hbase.zookeeper.MetaTableLocator#waitMetaRegionLocation() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HBaseClientCompatibilityTest.java    From armeria with Apache License 2.0 6 votes vote down vote up
/**
 * 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.getAll(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);
}
 
Example 2
Source File: ProcedureSyncWait.java    From hbase with Apache License 2.0 5 votes vote down vote up
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);
  }
}
 
Example 3
Source File: TestMetaTableLocator.java    From hbase with Apache License 2.0 5 votes vote down vote up
void doWaiting() throws InterruptedException {
  try {
    for (;;) {
      if (MetaTableLocator.waitMetaRegionLocation(watcher, 10000) != null) {
        break;
      }
    }
  } catch (NotAllMetaRegionsOnlineException e) {
    // Ignore
  }
}
 
Example 4
Source File: TestMetaTableLocator.java    From hbase with Apache License 2.0 4 votes vote down vote up
@Test(expected = NotAllMetaRegionsOnlineException.class)
public void testTimeoutWaitForMeta() throws IOException, InterruptedException {
  MetaTableLocator.waitMetaRegionLocation(watcher, 100);
}