Java 类org.apache.hadoop.hbase.regionserver.handler.OpenMetaHandler 实例源码

项目:RStore    文件:HRegionServer.java   
@Override
@QosPriority(priority = HIGH_QOS)
public RegionOpeningState openRegion(HRegionInfo region, int versionOfOfflineNode)
    throws IOException {
  checkOpen();
  checkIfRegionInTransition(region, OPEN);
  HRegion onlineRegion = this.getFromOnlineRegions(region.getEncodedName());
  if (null != onlineRegion) {
    // See HBASE-5094. Cross check with META if still this RS is owning the
    // region.
    Pair<HRegionInfo, ServerName> p = MetaReader.getRegion(
        this.catalogTracker, region.getRegionName());
    if (this.getServerName().equals(p.getSecond())) {
      LOG.warn("Attempted open of " + region.getEncodedName()
          + " but already online on this server");
      return RegionOpeningState.ALREADY_OPENED;
    } else {
      LOG.warn("The region " + region.getEncodedName()
          + " is online on this server but META does not have this server.");
      this.removeFromOnlineRegions(region.getEncodedName());
    }
  }
  LOG.info("Received request to open region: " +
    region.getRegionNameAsString());
  this.regionsInTransitionInRS.putIfAbsent(region.getEncodedNameAsBytes(),
      true);
  HTableDescriptor htd = this.tableDescriptors.get(region.getTableName());
  // Need to pass the expected version in the constructor.
  if (region.isRootRegion()) {
    this.service.submit(new OpenRootHandler(this, this, region, htd,
        versionOfOfflineNode));
  } else if (region.isMetaRegion()) {
    this.service.submit(new OpenMetaHandler(this, this, region, htd,
        versionOfOfflineNode));
  } else {
    this.service.submit(new OpenRegionHandler(this, this, region, htd,
        versionOfOfflineNode));
  }
  return RegionOpeningState.OPENED;
}
项目:LCIndex-HBase-0.94.16    文件:HRegionServer.java   
private RegionOpeningState openRegion(HRegionInfo region, int versionOfOfflineNode,
    Map<String, HTableDescriptor> htds) throws IOException {
  checkOpen();
  HRegion onlineRegion = this.getFromOnlineRegions(region.getEncodedName());
  if (null != onlineRegion) {
    // See HBASE-5094. Cross check with META if still this RS is owning the
    // region.
    Pair<HRegionInfo, ServerName> p =
        MetaReader.getRegion(this.catalogTracker, region.getRegionName());
    if (this.getServerName().equals(p.getSecond())) {
      LOG.warn("Attempted open of " + region.getEncodedName()
          + " but already online on this server");
      return RegionOpeningState.ALREADY_OPENED;
    } else {
      LOG.warn("The region " + region.getEncodedName()
          + " is online on this server but META does not have this server.");
      this.removeFromOnlineRegions(region.getEncodedName());
    }
  }
  // Added to in-memory RS RIT that we are trying to open this region.
  // Clear it if we fail queuing an open executor.
  boolean isNewRit = addRegionsInTransition(region, OPEN);
  if (!isNewRit) {
    // An open is in progress. This is supported, but let's log this.
    LOG.info("Receiving OPEN for the region:" + region.getRegionNameAsString()
        + " , which we are already trying to OPEN"
        + " - ignoring this new request for this region.");
    return RegionOpeningState.OPENED;
  }
  try {
    LOG.info("Received request to open region: " + region.getRegionNameAsString());
    HTableDescriptor htd = null;
    if (htds == null) {
      htd = this.tableDescriptors.get(region.getTableName());
    } else {
      htd = htds.get(region.getTableNameAsString());
      if (htd == null) {
        htd = this.tableDescriptors.get(region.getTableName());
        htds.put(region.getTableNameAsString(), htd);
      }
    }

    // Mark the region as OPENING up in zk. This is how we tell the master control of the
    // region has passed to this regionserver.
    int version = transitionZookeeperOfflineToOpening(region, versionOfOfflineNode);
    // Need to pass the expected version in the constructor.
    if (region.isRootRegion()) {
      this.service.submit(new OpenRootHandler(this, this, region, htd, version));
    } else if (region.isMetaRegion()) {
      this.service.submit(new OpenMetaHandler(this, this, region, htd, version));
    } else {
      this.service.submit(new OpenRegionHandler(this, this, region, htd, version));
    }
  } catch (IOException ie) {
    // Clear from this server's RIT list else will stick around for ever.
    removeFromRegionsInTransition(region);
    throw ie;
  }
  return RegionOpeningState.OPENED;
}
项目:IRIndex    文件:HRegionServer.java   
private RegionOpeningState openRegion(HRegionInfo region, int versionOfOfflineNode,
    Map<String, HTableDescriptor> htds) throws IOException {
  checkOpen();
  HRegion onlineRegion = this.getFromOnlineRegions(region.getEncodedName());
  if (null != onlineRegion) {
    // See HBASE-5094. Cross check with META if still this RS is owning the
    // region.
    Pair<HRegionInfo, ServerName> p = MetaReader.getRegion(
        this.catalogTracker, region.getRegionName());
    if (this.getServerName().equals(p.getSecond())) {
      LOG.warn("Attempted open of " + region.getEncodedName()
          + " but already online on this server");
      return RegionOpeningState.ALREADY_OPENED;
    } else {
      LOG.warn("The region " + region.getEncodedName()
          + " is online on this server but META does not have this server.");
      this.removeFromOnlineRegions(region.getEncodedName());
    }
  }
  // Added to in-memory RS RIT that we are trying to open this region.
  // Clear it if we fail queuing an open executor.
  boolean isNewRit = addRegionsInTransition(region, OPEN);
  if (!isNewRit) {
    // An open is in progress. This is supported, but let's log this.
    LOG.info("Receiving OPEN for the region:" +
        region.getRegionNameAsString() + " , which we are already trying to OPEN" +
        " - ignoring this new request for this region.");
    return RegionOpeningState.OPENED;
  }
  try {
    LOG.info("Received request to open region: " +
      region.getRegionNameAsString());
    HTableDescriptor htd = null;
    if (htds == null) {
      htd = this.tableDescriptors.get(region.getTableName());
    } else {
      htd = htds.get(region.getTableNameAsString());
      if (htd == null) {
        htd = this.tableDescriptors.get(region.getTableName());
        htds.put(region.getTableNameAsString(), htd);
      }
    }

    // Mark the region as OPENING up in zk.  This is how we tell the master control of the
    // region has passed to this regionserver.
    int version = transitionZookeeperOfflineToOpening(region, versionOfOfflineNode);
    // Need to pass the expected version in the constructor.
    if (region.isRootRegion()) {
      this.service.submit(new OpenRootHandler(this, this, region, htd, version));
    } else if (region.isMetaRegion()) {
      this.service.submit(new OpenMetaHandler(this, this, region, htd, version));
    } else {
      this.service.submit(new OpenRegionHandler(this, this, region, htd, version));
    }
  } catch (IOException ie) {
    // Clear from this server's RIT list else will stick around for ever.
    removeFromRegionsInTransition(region);
    throw ie;
  }
  return RegionOpeningState.OPENED;
}
项目:HBase-Research    文件:HRegionServer.java   
private RegionOpeningState openRegion(HRegionInfo region, int versionOfOfflineNode,
    Map<String, HTableDescriptor> htds) throws IOException {
  checkOpen();
  HRegion onlineRegion = this.getFromOnlineRegions(region.getEncodedName());
  if (null != onlineRegion) {
    // See HBASE-5094. Cross check with META if still this RS is owning the
    // region.
    Pair<HRegionInfo, ServerName> p = MetaReader.getRegion(
        this.catalogTracker, region.getRegionName());
    if (this.getServerName().equals(p.getSecond())) {
      LOG.warn("Attempted open of " + region.getEncodedName()
          + " but already online on this server");
      return RegionOpeningState.ALREADY_OPENED;
    } else {
      LOG.warn("The region " + region.getEncodedName()
          + " is online on this server but META does not have this server.");
      this.removeFromOnlineRegions(region.getEncodedName());
    }
  }
  // Added to in-memory RS RIT that we are trying to open this region.
  // Clear it if we fail queuing an open executor.
  boolean isNewRit = addRegionsInTransition(region, OPEN);
  if (!isNewRit) {
    // An open is in progress. This is supported, but let's log this.
    LOG.info("Receiving OPEN for the region:" +
        region.getRegionNameAsString() + " , which we are already trying to OPEN" +
        " - ignoring this new request for this region.");
    return RegionOpeningState.OPENED;
  }
  try {
    LOG.info("Received request to open region: " +
      region.getRegionNameAsString());
    HTableDescriptor htd = null;
    if (htds == null) {
      htd = this.tableDescriptors.get(region.getTableName());
    } else {
      htd = htds.get(region.getTableNameAsString());
      if (htd == null) {
        htd = this.tableDescriptors.get(region.getTableName());
        htds.put(region.getTableNameAsString(), htd);
      }
    }

    // Mark the region as OPENING up in zk.  This is how we tell the master control of the
    // region has passed to this regionserver.
    int version = transitionZookeeperOfflineToOpening(region, versionOfOfflineNode);
    // Need to pass the expected version in the constructor.
    if (region.isRootRegion()) {
      this.service.submit(new OpenRootHandler(this, this, region, htd, version));
    } else if (region.isMetaRegion()) {
      this.service.submit(new OpenMetaHandler(this, this, region, htd, version));
    } else {
      this.service.submit(new OpenRegionHandler(this, this, region, htd, version));
    }
  } catch (IOException ie) {
    // Clear from this server's RIT list else will stick around for ever.
    removeFromRegionsInTransition(region);
    throw ie;
  }
  return RegionOpeningState.OPENED;
}
项目:hbase-0.94.8-qod    文件:HRegionServer.java   
private RegionOpeningState openRegion(HRegionInfo region, int versionOfOfflineNode,
    Map<String, HTableDescriptor> htds) throws IOException {
  checkOpen();
  HRegion onlineRegion = this.getFromOnlineRegions(region.getEncodedName());
  if (null != onlineRegion) {
    // See HBASE-5094. Cross check with META if still this RS is owning the
    // region.
    Pair<HRegionInfo, ServerName> p = MetaReader.getRegion(
        this.catalogTracker, region.getRegionName());
    if (this.getServerName().equals(p.getSecond())) {
      LOG.warn("Attempted open of " + region.getEncodedName()
          + " but already online on this server");
      return RegionOpeningState.ALREADY_OPENED;
    } else {
      LOG.warn("The region " + region.getEncodedName()
          + " is online on this server but META does not have this server.");
      this.removeFromOnlineRegions(region.getEncodedName());
    }
  }
  // Added to in-memory RS RIT that we are trying to open this region.
  // Clear it if we fail queuing an open executor.
  boolean isNewRit = addRegionsInTransition(region, OPEN);
  if (!isNewRit) {
    // An open is in progress. This is supported, but let's log this.
    LOG.info("Receiving OPEN for the region:" +
        region.getRegionNameAsString() + " , which we are already trying to OPEN" +
        " - ignoring this new request for this region.");
    return RegionOpeningState.OPENED;
  }
  try {
    LOG.info("Received request to open region: " +
      region.getRegionNameAsString());
    HTableDescriptor htd = null;
    if (htds == null) {
      htd = this.tableDescriptors.get(region.getTableName());
    } else {
      htd = htds.get(region.getTableNameAsString());
      if (htd == null) {
        htd = this.tableDescriptors.get(region.getTableName());
        htds.put(region.getTableNameAsString(), htd);
      }
    }

    // Mark the region as OPENING up in zk.  This is how we tell the master control of the
    // region has passed to this regionserver.
    int version = transitionZookeeperOfflineToOpening(region, versionOfOfflineNode);
    // Need to pass the expected version in the constructor.
    if (region.isRootRegion()) {
      this.service.submit(new OpenRootHandler(this, this, region, htd, version));
    } else if (region.isMetaRegion()) {
      this.service.submit(new OpenMetaHandler(this, this, region, htd, version));
    } else {
      this.service.submit(new OpenRegionHandler(this, this, region, htd, version));
    }
  } catch (IOException ie) {
    // Clear from this server's RIT list else will stick around for ever.
    removeFromRegionsInTransition(region);
    throw ie;
  }
  return RegionOpeningState.OPENED;
}
项目:hbase-0.94.8-qod    文件:HRegionServer.java   
private RegionOpeningState openRegion(HRegionInfo region, int versionOfOfflineNode,
    Map<String, HTableDescriptor> htds) throws IOException {
  checkOpen();
  HRegion onlineRegion = this.getFromOnlineRegions(region.getEncodedName());
  if (null != onlineRegion) {
    // See HBASE-5094. Cross check with META if still this RS is owning the
    // region.
    Pair<HRegionInfo, ServerName> p = MetaReader.getRegion(
        this.catalogTracker, region.getRegionName());
    if (this.getServerName().equals(p.getSecond())) {
      LOG.warn("Attempted open of " + region.getEncodedName()
          + " but already online on this server");
      return RegionOpeningState.ALREADY_OPENED;
    } else {
      LOG.warn("The region " + region.getEncodedName()
          + " is online on this server but META does not have this server.");
      this.removeFromOnlineRegions(region.getEncodedName());
    }
  }
  // Added to in-memory RS RIT that we are trying to open this region.
  // Clear it if we fail queuing an open executor.
  boolean isNewRit = addRegionsInTransition(region, OPEN);
  if (!isNewRit) {
    // An open is in progress. This is supported, but let's log this.
    LOG.info("Receiving OPEN for the region:" +
        region.getRegionNameAsString() + " , which we are already trying to OPEN" +
        " - ignoring this new request for this region.");
    return RegionOpeningState.OPENED;
  }
  try {
    LOG.info("Received request to open region: " +
      region.getRegionNameAsString());
    HTableDescriptor htd = null;
    if (htds == null) {
      htd = this.tableDescriptors.get(region.getTableName());
    } else {
      htd = htds.get(region.getTableNameAsString());
      if (htd == null) {
        htd = this.tableDescriptors.get(region.getTableName());
        htds.put(region.getTableNameAsString(), htd);
      }
    }

    // Mark the region as OPENING up in zk.  This is how we tell the master control of the
    // region has passed to this regionserver.
    int version = transitionZookeeperOfflineToOpening(region, versionOfOfflineNode);
    // Need to pass the expected version in the constructor.
    if (region.isRootRegion()) {
      this.service.submit(new OpenRootHandler(this, this, region, htd, version));
    } else if (region.isMetaRegion()) {
      this.service.submit(new OpenMetaHandler(this, this, region, htd, version));
    } else {
      this.service.submit(new OpenRegionHandler(this, this, region, htd, version));
    }
  } catch (IOException ie) {
    // Clear from this server's RIT list else will stick around for ever.
    removeFromRegionsInTransition(region);
    throw ie;
  }
  return RegionOpeningState.OPENED;
}
项目:hindex    文件:HRegionServer.java   
private RegionOpeningState openRegion(HRegionInfo region, int versionOfOfflineNode,
    Map<String, HTableDescriptor> htds) throws IOException {
  checkOpen();
  HRegion onlineRegion = this.getFromOnlineRegions(region.getEncodedName());
  if (null != onlineRegion) {
    // See HBASE-5094. Cross check with META if still this RS is owning the
    // region.
    Pair<HRegionInfo, ServerName> p = MetaReader.getRegion(
        this.catalogTracker, region.getRegionName());
    if (this.getServerName().equals(p.getSecond())) {
      LOG.warn("Attempted open of " + region.getEncodedName()
          + " but already online on this server");
      return RegionOpeningState.ALREADY_OPENED;
    } else {
      LOG.warn("The region " + region.getEncodedName()
          + " is online on this server but META does not have this server.");
      this.removeFromOnlineRegions(region.getEncodedName());
    }
  }
  // Added to in-memory RS RIT that we are trying to open this region.
  // Clear it if we fail queuing an open executor.
  boolean isNewRit = addRegionsInTransition(region, OPEN);
  if (!isNewRit) {
    // An open is in progress. This is supported, but let's log this.
    LOG.info("Receiving OPEN for the region:" +
        region.getRegionNameAsString() + " , which we are already trying to OPEN" +
        " - ignoring this new request for this region.");
    return RegionOpeningState.OPENED;
  }
  try {
    LOG.info("Received request to open region: " +
      region.getRegionNameAsString());
    HTableDescriptor htd = null;
    if (htds == null) {
      htd = this.tableDescriptors.get(region.getTableName());
    } else {
      htd = htds.get(region.getTableNameAsString());
      if (htd == null) {
        htd = this.tableDescriptors.get(region.getTableName());
        htds.put(region.getTableNameAsString(), htd);
      }
    }

    // Mark the region as OPENING up in zk.  This is how we tell the master control of the
    // region has passed to this regionserver.
    int version = transitionZookeeperOfflineToOpening(region, versionOfOfflineNode);
    // Need to pass the expected version in the constructor.
    if (region.isRootRegion()) {
      this.service.submit(new OpenRootHandler(this, this, region, htd, version));
    } else if (region.isMetaRegion()) {
      this.service.submit(new OpenMetaHandler(this, this, region, htd, version));
    } else {
      this.service.submit(new OpenRegionHandler(this, this, region, htd, version));
    }
  } catch (IOException ie) {
    // Clear from this server's RIT list else will stick around for ever.
    removeFromRegionsInTransition(region);
    throw ie;
  }
  return RegionOpeningState.OPENED;
}