Examples of HRegionInterface


Examples of org.apache.hadoop.hbase.ipc.HRegionInterface

    throws IOException {
    Set<MetaRegion> regions = regionManager.getMetaRegionsForTable(tableName);
    for (MetaRegion m: regions) {
      byte [] firstRowInTable = Bytes.toBytes(Bytes.toString(tableName) + ",,");
      byte [] metaRegionName = m.getRegionName();
      HRegionInterface srvr = connection.getHRegionConnection(m.getServer());
      Scan scan = new Scan(firstRowInTable);
      scan.addColumn(CATALOG_FAMILY, REGIONINFO_QUALIFIER);
      scan.addColumn(CATALOG_FAMILY, SERVER_QUALIFIER);
      long scannerid = srvr.openScanner(metaRegionName, scan);
      try {
        while (true) {
          Result data = srvr.next(scannerid);
          if (data == null || data.size() <= 0)
            break;
          HRegionInfo info = Writables.getHRegionInfo(
              data.getValue(CATALOG_FAMILY, REGIONINFO_QUALIFIER));
          if (Bytes.compareTo(info.getTableDesc().getName(), tableName) == 0) {
            if ((Bytes.compareTo(info.getStartKey(), rowKey) >= 0) &&
                (Bytes.compareTo(info.getEndKey(), rowKey) < 0)) {
                byte [] value = data.getValue(CATALOG_FAMILY, SERVER_QUALIFIER);
                if (value != null) {
                  HServerAddress server =
                    new HServerAddress(Bytes.toString(value));
                  return new Pair<HRegionInfo,HServerAddress>(info, server);
                }
            }
          } else {
            break;
          }
        }
      } finally {
        srvr.close(scannerid);
      }
    }
    return null;
  }
View Full Code Here

Examples of org.apache.hadoop.hbase.ipc.HRegionInterface

    throws IOException {
    byte [] tableName = HRegionInfo.parseRegionName(regionName)[0];
    Set<MetaRegion> regions = regionManager.getMetaRegionsForTable(tableName);
    for (MetaRegion m: regions) {
      byte [] metaRegionName = m.getRegionName();
      HRegionInterface srvr = connection.getHRegionConnection(m.getServer());
      Get get = new Get(regionName);
      get.addColumn(CATALOG_FAMILY, REGIONINFO_QUALIFIER);
      get.addColumn(CATALOG_FAMILY, SERVER_QUALIFIER);
      Result data = srvr.get(metaRegionName, get);
      if(data == null || data.size() <= 0) continue;
      HRegionInfo info = Writables.getHRegionInfo(
          data.getValue(CATALOG_FAMILY, REGIONINFO_QUALIFIER));
      byte [] value = data.getValue(CATALOG_FAMILY, SERVER_QUALIFIER);
      if(value != null) {
View Full Code Here

Examples of org.apache.hadoop.hbase.ipc.HRegionInterface

   * @throws IOException
   */
  protected Result getFromMETA(final byte [] row, final byte [] family)
  throws IOException {
    MetaRegion meta = this.regionManager.getMetaRegionForRow(row);
    HRegionInterface srvr = getMETAServer(meta);
    Get get = new Get(row);
    get.addFamily(family);
    return srvr.get(meta.getRegionName(), get);
  }
View Full Code Here

Examples of org.apache.hadoop.hbase.ipc.HRegionInterface

      LOG.info("Marking " + hri.getRegionNameAsString() +
        " as closing on " + name + "; cleaning SERVER + STARTCODE; " +
          "master will tell regionserver to close region on next heartbeat");
      this.regionManager.setClosing(name, hri, hri.isOffline());
      MetaRegion meta = this.regionManager.getMetaRegionForRow(regionname);
      HRegionInterface srvr = getMETAServer(meta);
      HRegion.cleanRegionInMETA(srvr, meta.getRegionName(), hri);
      break;

    default:
      throw new IOException("unsupported modifyTable op " + op);
View Full Code Here

Examples of org.apache.hadoop.hbase.ipc.HRegionInterface

      // is online. metaRegionAvailable() has put this operation on the
      // delayedToDoQueue, so return true so the operation is not put
      // back on the toDoQueue
      return true;
    }
    HRegionInterface server =
        master.connection.getHRegionConnection(getMetaRegion().getServer());
    LOG.info(regionInfo.getRegionNameAsString() + " open on " +
        serverInfo.getServerAddress().toString());

    // Register the newly-available Region's location.
    Put p = new Put(regionInfo.getRegionName());
    p.add(CATALOG_FAMILY, SERVER_QUALIFIER,
      Bytes.toBytes(serverInfo.getServerAddress().toString()));
    p.add(CATALOG_FAMILY, STARTCODE_QUALIFIER,
      Bytes.toBytes(serverInfo.getStartCode()));
    server.put(metaRegionName, p);
    LOG.info("Updated row " + regionInfo.getRegionNameAsString() +
      " in region " + Bytes.toString(metaRegionName) + " with startcode=" +
      serverInfo.getStartCode() + ", server=" + serverInfo.getServerAddress());
    synchronized (master.regionManager) {
      if (isMetaTable) {
View Full Code Here

Examples of org.apache.hadoop.hbase.ipc.HRegionInterface

    @Override
    public synchronized Void call() throws IOException {
      errors.progress();
      try {
        HRegionInterface server =
            connection.getHRegionConnection(rsinfo.getHostname(), rsinfo.getPort());

        // list all online regions from this region server
        List<HRegionInfo> regions = server.getOnlineRegions();
        regions = filterRegions(regions);
        if (details) {
          errors.detail("RegionServer: " + rsinfo.getServerName() +
                           " number of regions: " + regions.size());
          for (HRegionInfo rinfo: regions) {
View Full Code Here

Examples of org.apache.hadoop.hbase.ipc.HRegionInterface

   */
  private HRegionInterface getMetaServerConnection()
  throws IOException, InterruptedException {
    synchronized (metaAvailable) {
      if (metaAvailable.get()) {
        HRegionInterface current = getCachedConnection(this.metaLocation);
        // If we are to refresh, verify we have a good connection by making
        // an invocation on it.
        if (verifyRegionLocation(current, this.metaLocation, META_REGION_NAME)) {
          return current;
        }
        resetMetaLocation();
      }
      // We got here because there is no meta available or because whats
      // available is bad.

      // Now read the current .META. content from -ROOT-.  Note: This goes via
      // an HConnection.  It has its own way of figuring root and meta locations
      // which we have to wait on.
      ServerName newLocation = MetaReader.getMetaRegionLocation(this);
      if (newLocation == null) return null;

      HRegionInterface newConnection = getCachedConnection(newLocation);
      if (verifyRegionLocation(newConnection, newLocation, META_REGION_NAME)) {
        setMetaLocation(newLocation);
        return newConnection;
      } else {
        if (LOG.isTraceEnabled()) {
View Full Code Here

Examples of org.apache.hadoop.hbase.ipc.HRegionInterface

  private HRegionInterface getCachedConnection(ServerName sn)
  throws IOException {
    if (sn == null) {
      return null;
    }
    HRegionInterface protocol = null;
    try {
      protocol = connection.getHRegionConnection(sn.getHostname(), sn.getPort());
    } catch (RetriesExhaustedException e) {
      if (e.getCause() != null && e.getCause() instanceof ConnectException) {
        // Catch this; presume it means the cached connection has gone bad.
View Full Code Here

Examples of org.apache.hadoop.hbase.ipc.HRegionInterface

   * @throws IOException
   * @throws InterruptedException
   */
  public boolean verifyRootRegionLocation(final long timeout)
  throws InterruptedException, IOException {
    HRegionInterface connection = null;
    try {
      connection = waitForRootServerConnection(timeout);
    } catch (NotAllMetaRegionsOnlineException e) {
      // Pass
    } catch (ServerNotRunningYetException e) {
View Full Code Here

Examples of org.apache.hadoop.hbase.ipc.HRegionInterface

   * @throws IOException Some unexpected IOE.
   * @throws InterruptedException
   */
  public boolean verifyMetaRegionLocation(final long timeout)
  throws InterruptedException, IOException {
    HRegionInterface connection = null;
    try {
      connection = waitForMetaServerConnection(timeout);
    } catch (NotAllMetaRegionsOnlineException e) {
      // Pass
    } catch (ServerNotRunningYetException e) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.