Package org.apache.hadoop.hbase.zookeeper

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


    }

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

    // watch for snapshots and other procedures
    try {
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

    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

      ZooKeeperWatcher zkw, HConnection hConnection, final TableName tableName,
      final boolean excludeOfflinedSplitParents) throws IOException, InterruptedException {

    if (tableName.equals(TableName.META_TABLE_NAME)) {
      // If meta, do a bit of special handling.
      ServerName serverName = new MetaTableLocator().getMetaRegionLocation(zkw);
      List<Pair<HRegionInfo, ServerName>> list =
        new ArrayList<Pair<HRegionInfo, ServerName>>();
      list.add(new Pair<HRegionInfo, ServerName>(HRegionInfo.FIRST_META_REGIONINFO,
        serverName));
      return list;
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

    tmpl.render(response.getWriter(),
          master, admin);
  }

  private ServerName getMetaLocationOrNull(HMaster master) {
    MetaTableLocator metaTableLocator = master.getMetaTableLocator();
    return metaTableLocator == null ? null :
      metaTableLocator.getMetaRegionLocation(master.getZooKeeper());
  }
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

  @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();
    ServerName meta = new MetaTableLocator().getMetaRegionLocation(this.watcher);
    Assert.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

      thenThrow(new ServiceException(ex));

    MetaTableLocator.setMetaLocation(this.watcher, SN);
    long timeout = UTIL.getConfiguration().
      getLong("hbase.catalog.verification.timeout", 1000);
    Assert.assertFalse(new MetaTableLocator().verifyMetaRegionLocation(
      connection, watcher, timeout));
  }
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.