Package org.apache.hadoop.hbase.zookeeper

Examples of org.apache.hadoop.hbase.zookeeper.MetaTableLocator


    Mockito.when(connection.getAdmin(Mockito.any(ServerName.class), Mockito.anyBoolean())).
      thenReturn(implementation);

    MetaTableLocator.setMetaLocation(this.watcher,
      ServerName.valueOf("example.com", 1234, System.currentTimeMillis()));
    Assert.assertFalse(new MetaTableLocator().verifyMetaRegionLocation(connection, watcher, 100));
  }
View Full Code Here


  }

  @Test (expected = NotAllMetaRegionsOnlineException.class)
  public void testTimeoutWaitForMeta()
  throws IOException, InterruptedException {
    new MetaTableLocator().waitMetaRegionLocation(watcher, 100);
  }
View Full Code Here

   * @throws InterruptedException
   * @throws KeeperException
   */
  @Test public void testNoTimeoutWaitForMeta()
  throws IOException, InterruptedException, KeeperException {
    final MetaTableLocator mtl = new MetaTableLocator();
    ServerName hsa = mtl.getMetaRegionLocation(watcher);
    Assert.assertNull(hsa);

    // Now test waiting on meta location getting set.
    Thread t = new WaitOnMetaThread();
    startWaitAliveThenWaitItLives(t, 1);
    // Set a meta location.
    hsa = setMetaLocation();
    // Join the thread... should exit shortly.
    t.join();
    // Now meta is available.
    Assert.assertTrue(mtl.getMetaRegionLocation(watcher).equals(hsa));
  }
View Full Code Here

      LOG.info("Exiting " + getName());
    }

    void doWaiting() throws InterruptedException {
      try {
        while (new MetaTableLocator().waitMetaRegionLocation(watcher, 10000) == null);
      } catch (NotAllMetaRegionsOnlineException e) {
        //Ignore
      }
    }
View Full Code Here

    try {
      if (LOG.isTraceEnabled()) {
        LOG.trace("Looking up meta region location in ZK," + " connection=" + this);
      }
      ServerName servername = new MetaTableLocator().blockUntilAvailable(zkw, hci.rpcTimeout);
      if (LOG.isTraceEnabled()) {
        LOG.trace("Looked up meta region location, connection=" + this +
          "; serverName=" + ((servername == null) ? "null" : servername));
      }
      if (servername == null) return null;
View Full Code Here

  }

  @Test public void testGetRegionsFromMetaTable()
  throws IOException, InterruptedException {
    List<HRegionInfo> regions =
      new MetaTableLocator().getMetaRegions(UTIL.getZooKeeperWatcher());
    assertTrue(regions.size() >= 1);
    assertTrue(new MetaTableLocator().getMetaRegionsAndLocations(
      UTIL.getZooKeeperWatcher()).size() >= 1);
  }
View Full Code Here

      if (admin != null) {
        admin.close();
      }
    }
    regionStates.regionOffline(HRegionInfo.FIRST_META_REGIONINFO);
    new MetaTableLocator().deleteMetaLocation(cluster.getMaster().getZooKeeper());
    assertFalse(regionStates.isRegionOnline(HRegionInfo.FIRST_META_REGIONINFO));
    HBaseFsck hbck = doFsck(conf, true);
    assertErrors(hbck, new ERROR_CODE[] { ERROR_CODE.UNKNOWN, ERROR_CODE.NO_META_REGION,
        ERROR_CODE.NULL_META_REGION });
    assertNoErrors(doFsck(conf, false));
View Full Code Here

    // Master is down, so is the meta. We need to assign it somewhere
    // so that regions can be assigned during the mocking phase.
    HRegionServer hrs = HTU.getHBaseCluster()
      .getLiveRegionServerThreads().get(0).getRegionServer();
    ZooKeeperWatcher zkw = hrs.getZooKeeper();
    MetaTableLocator mtl = new MetaTableLocator();
    ServerName sn = mtl.getMetaRegionLocation(zkw);
    if (sn != null && !masterAddr.equals(sn)) {
      return;
    }

    ProtobufUtil.openRegion(hrs.getRSRpcServices(),
      hrs.getServerName(), HRegionInfo.FIRST_META_REGIONINFO);
    while (true) {
      sn = mtl.getMetaRegionLocation(zkw);
      if (sn != null && sn.equals(hrs.getServerName())
          && hrs.onlineRegions.containsKey(
              HRegionInfo.FIRST_META_REGIONINFO.getEncodedName())) {
        break;
      }
View Full Code Here

      checkTableExists(tableName);
      zookeeper = new ZooKeeperWatcher(conf, ZK_IDENTIFIER_PREFIX + connection.toString(),
          new ThrowableAbortable());
      List<Pair<HRegionInfo, ServerName>> pairs;
      if (TableName.META_TABLE_NAME.equals(tableName)) {
        pairs = new MetaTableLocator().getMetaRegionsAndLocations(zookeeper);
      } else {
        pairs = MetaTableAccessor.getTableRegionsAndLocations(connection, tableName);
      }
      for (Pair<HRegionInfo, ServerName> pair: pairs) {
        if (pair.getFirst().isOffline()) continue;
View Full Code Here

      checkTableExists(tableName);
      zookeeper = new ZooKeeperWatcher(conf, ZK_IDENTIFIER_PREFIX + connection.toString(),
        new ThrowableAbortable());
      List<Pair<HRegionInfo, ServerName>> pairs;
      if (TableName.META_TABLE_NAME.equals(tableName)) {
        pairs = new MetaTableLocator().getMetaRegionsAndLocations(zookeeper);
      } else {
        pairs = MetaTableAccessor.getTableRegionsAndLocations(connection, tableName);
      }
      for (Pair<HRegionInfo, ServerName> pair: pairs) {
        // May not be a server for a particular row
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hbase.zookeeper.MetaTableLocator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.