Package org.apache.hadoop.hbase

Examples of org.apache.hadoop.hbase.HRegion$WriteState


   * regions, it will be some time before someone has enough data in HBase to
   * split the meta region and even less likely that a merge of two meta
   * regions will be needed, but it is included for completeness.
   */
  private void mergeTwoMetaRegions() throws IOException {
    HRegion rootRegion = utils.getRootRegion();
    HRegionInfo info1 = Writables.getHRegionInfoOrNull(
        rootRegion.get(region1, HConstants.COL_REGIONINFO));
    HRegionInfo info2 = Writables.getHRegionInfoOrNull(
        rootRegion.get(region2, HConstants.COL_REGIONINFO));
    HRegion merged = merge(info1, rootRegion, info2, rootRegion);
    LOG.info("Adding " + merged.getRegionInfo() + " to " +
        rootRegion.getRegionInfo());
    HRegion.addRegionToMETA(rootRegion, merged);
    merged.close();
  }
View Full Code Here


    HRegionInfo meta2 = listener.getMeta2();
    if (meta2 == null) {
      throw new IOException("Could not find meta region for " + region2);
    }

    HRegion metaRegion1 = utils.getMetaRegion(meta1);
    HRegionInfo info1 = Writables.getHRegionInfoOrNull(
        metaRegion1.get(region1, HConstants.COL_REGIONINFO));


    HRegion metaRegion2 = null;
    if (meta1.getRegionName().equals(meta2.getRegionName())) {
      metaRegion2 = metaRegion1;
    } else {
      metaRegion2 = utils.getMetaRegion(meta2);
    }
    HRegionInfo info2 = Writables.getHRegionInfoOrNull(
        metaRegion2.get(region2, HConstants.COL_REGIONINFO));

    HRegion merged = merge(info1, metaRegion1, info2, metaRegion2);

    // Now find the meta region which will contain the newly merged region

    listener = new MetaScannerListener(merged.getRegionName(), null);
    utils.scanRootRegion(listener);
    HRegionInfo mergedInfo = listener.getMeta1();
    if (mergedInfo == null) {
      throw new IOException("Could not find meta region for " +
          merged.getRegionName());
    }
    HRegion mergeMeta = null;
    if (mergedInfo.getRegionName().equals(meta1.getRegionName())) {
      mergeMeta = metaRegion1;
    } else if (mergedInfo.getRegionName().equals(meta2.getRegionName())) {
      mergeMeta = metaRegion2;
    } else {
      mergeMeta = utils.getMetaRegion(mergedInfo);
    }
    LOG.info("Adding " + merged.getRegionInfo() + " to " +
        mergeMeta.getRegionInfo());

    HRegion.addRegionToMETA(mergeMeta, merged);
    merged.close();
  }
View Full Code Here

    }
    if (info2 == null) {
      throw new IOException("Cound not find " + region2 + " in " +
          meta2.getRegionName());
    }
    HRegion merged = null;
    HLog log = utils.getLog();
    HRegion region1 =
      HRegion.openHRegion(info1, this.rootdir, log, this.conf);
    try {
      HRegion region2 =
        HRegion.openHRegion(info2, this.rootdir, log, this.conf);
      try {
        merged = HRegion.merge(region1, region2);
      } finally {
        if (!region2.isClosed()) {
          region2.close();
        }
      }
    } finally {
      if (!region1.isClosed()) {
        region1.close();
View Full Code Here

   */
  public HRegion getMetaRegion(HRegionInfo metaInfo) throws IOException {
    if (!initialized) {
      throw new IllegalStateException("Must call initialize method first.");
    }
    HRegion meta = metaRegions.get(metaInfo.getRegionName());
    if (meta == null) {
      meta = openMetaRegion(metaInfo);
      metaRegions.put(metaInfo.getRegionName(), meta);
    }
    return meta;
View Full Code Here

      throw new IllegalStateException("Must call initialize method first.");
    }
   
    // Open meta region so we can scan it

    HRegion metaRegion = openMetaRegion(metaRegionInfo);

    HScannerInterface metaScanner = metaRegion.getScanner(
        HConstants.COL_REGIONINFO_ARRAY, HConstants.EMPTY_START_ROW,
        HConstants.LATEST_TIMESTAMP, null);

    try {
      HStoreKey key = new HStoreKey();
View Full Code Here

        this.rootdir, this.log, this.conf);
    this.rootRegion.compactStores();
  }
 
  private HRegion openMetaRegion(HRegionInfo metaInfo) throws IOException {
    HRegion meta =
      HRegion.openHRegion(metaInfo, this.rootdir, this.log, this.conf);
    meta.compactStores();
    return meta;
  }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hbase.HRegion$WriteState

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.