Package org.apache.hadoop.hbase.zookeeper

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


      new ZooKeeperWatcher(conf, ZK_IDENTIFIER_PREFIX + connection.toString(),
        new ThrowableAbortable());
    List<HRegionInfo> regions = null;
    try {
      if (TableName.META_TABLE_NAME.equals(tableName)) {
        regions = new MetaTableLocator().getMetaRegions(zookeeper);
      } else {
        regions = MetaTableAccessor.getTableRegions(connection, tableName, true);
      }
    } finally {
      zookeeper.close();
View Full Code Here


        new ThrowableAbortable());
    try {
      checkTableExists(tableName);
      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

    this.serverManager = createServerManager(this, this);

    synchronized (this) {
      if (shortCircuitConnection == null) {
        shortCircuitConnection = createShortCircuitConnection();
        metaTableLocator = new MetaTableLocator();
      }
    }

    // Invalidate all write locks held previously
    this.tableLockManager.reapWriteLocks();
View Full Code Here

  private ServerName getMetaRegionServerName()
  throws IOException, KeeperException {
    ZooKeeperWatcher zkw = createZooKeeperWatcher();
    ServerName sn = null;
    try {
      sn = new MetaTableLocator().getMetaRegionLocation(zkw);
    } finally {
      zkw.close();
    }
    return sn;
  }
View Full Code Here

  private void preRegistrationInitialization(){
    try {
      synchronized (this) {
        if (shortCircuitConnection == null) {
          shortCircuitConnection = createShortCircuitConnection();
          metaTableLocator = new MetaTableLocator();
        }
      }

      // Health checker thread.
      if (isHealthCheckerConfigured()) {
View Full Code Here

   * @throws IOException if we can't reach hbase:meta or read the files from the FS
   */
  private void verifyRegions(final SnapshotManifest manifest) throws IOException {
    List<HRegionInfo> regions;
    if (TableName.META_TABLE_NAME.equals(tableName)) {
      regions = new MetaTableLocator().getMetaRegions(services.getZooKeeper());
    } else {
      regions = MetaTableAccessor.getTableRegions(services.getShortCircuitConnection(), tableName);
    }
    // Remove the non-default regions
    RegionReplicaUtil.removeNonDefaultRegions(regions);
View Full Code Here

      snapshotManifest.addTableDescriptor(this.htd);
      monitor.rethrowException();

      List<Pair<HRegionInfo, ServerName>> regionsAndLocations;
      if (TableName.META_TABLE_NAME.equals(snapshotTable)) {
        regionsAndLocations = new MetaTableLocator().getMetaRegionsAndLocations(
          server.getZooKeeper());
      } else {
        regionsAndLocations = MetaTableAccessor.getTableRegionsAndLocations(
          server.getShortCircuitConnection(), snapshotTable, false);
      }
View Full Code Here

  @After public void after() {
    try {
      // Clean out meta location or later tests will be confused... they presume
      // start fresh in zk.
      new MetaTableLocator().deleteMetaLocation(this.watcher);
    } catch (KeeperException e) {
      LOG.warn("Unable to delete hbase:meta location", e);
    }

    // Clear out our doctored connection or could mess up subsequent tests.
View Full Code Here

            Mockito.mock(ClientProtos.ClientService.BlockingInterface.class);

    Mockito.when(client.get((RpcController)Mockito.any(), (GetRequest)Mockito.any())).
            thenReturn(GetResponse.newBuilder().build());

    final MetaTableLocator mtl = new MetaTableLocator();
    assertNull(mtl.getMetaRegionLocation(this.watcher));
    for (RegionState.State state : RegionState.State.values()) {
      if (state.equals(RegionState.State.OPEN))
        continue;
      MetaTableLocator.setMetaLocation(this.watcher, SN, state);
      assertNull(mtl.getMetaRegionLocation(this.watcher));
      assertEquals(state, MetaTableLocator.getMetaRegionState(this.watcher).getState());
    }
    MetaTableLocator.setMetaLocation(this.watcher, SN, RegionState.State.OPEN);
    assertEquals(mtl.getMetaRegionLocation(this.watcher), SN);
    assertEquals(RegionState.State.OPEN,
      MetaTableLocator.getMetaRegionState(this.watcher).getState());

    mtl.deleteMetaLocation(this.watcher);
    assertNull(MetaTableLocator.getMetaRegionState(this.watcher).getServerName());
    assertEquals(MetaTableLocator.getMetaRegionState(this.watcher).getState(),
      RegionState.State.OFFLINE);
    assertNull(mtl.getMetaRegionLocation(this.watcher));
  }
View Full Code Here

      Mockito.mock(ClientProtos.ClientService.BlockingInterface.class);

    Mockito.when(client.get((RpcController)Mockito.any(), (GetRequest)Mockito.any())).
    thenReturn(GetResponse.newBuilder().build());

    final MetaTableLocator mtl = new MetaTableLocator();
    ServerName meta = new MetaTableLocator().getMetaRegionLocation(this.watcher);
    assertNull(meta);
    Thread t = new Thread() {
      @Override
      public void run() {
        try {
          mtl.waitMetaRegionLocation(watcher);
        } catch (InterruptedException e) {
          throw new RuntimeException("Interrupted", e);
        }
      }
    };
    t.start();
    while (!t.isAlive())
      Threads.sleep(1);
    Threads.sleep(1);
    assertTrue(t.isAlive());
    mtl.stop();
    // Join the thread... should exit shortly.
    t.join();
  }
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.