当前位置: 首页>>代码示例>>Java>>正文


Java AssignmentManager.RegionState方法代码示例

本文整理汇总了Java中org.apache.hadoop.hbase.master.AssignmentManager.RegionState方法的典型用法代码示例。如果您正苦于以下问题:Java AssignmentManager.RegionState方法的具体用法?Java AssignmentManager.RegionState怎么用?Java AssignmentManager.RegionState使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.hbase.master.AssignmentManager的用法示例。


在下文中一共展示了AssignmentManager.RegionState方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: waitForRITtoBeZero

import org.apache.hadoop.hbase.master.AssignmentManager; //导入方法依赖的package包/类
private void waitForRITtoBeZero(HMaster master) throws IOException {
  // wait for assignments to finish
  AssignmentManager mgr = master.getAssignmentManager();
  Collection<AssignmentManager.RegionState> transRegions =
      mgr.getRegionsInTransition().values();
  for (AssignmentManager.RegionState state : transRegions) {
    mgr.waitOnRegionToClearRegionsInTransition(state.getRegion());
  }
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:10,代码来源:TestMasterObserver.java

示例2: handleTableOperation

import org.apache.hadoop.hbase.master.AssignmentManager; //导入方法依赖的package包/类
@Override
protected void handleTableOperation(List<HRegionInfo> regions)
throws IOException, KeeperException {
  AssignmentManager am = this.masterServices.getAssignmentManager();
  long waitTime = server.getConfiguration().
    getLong("hbase.master.wait.on.region", 5 * 60 * 1000);
  for (HRegionInfo region : regions) {
    long done = System.currentTimeMillis() + waitTime;
    while (System.currentTimeMillis() < done) {
      AssignmentManager.RegionState rs = am.isRegionInTransition(region);
      if (rs == null) break;
      Threads.sleep(waitingTimeForEvents);
      LOG.debug("Waiting on  region to clear regions in transition; " + rs);
    }
    if (am.isRegionInTransition(region) != null) {
      throw new IOException("Waited hbase.master.wait.on.region (" +
        waitTime + "ms) for region to leave region " +
        region.getRegionNameAsString() + " in transitions");
    }
    LOG.debug("Deleting region " + region.getRegionNameAsString() +
      " from META and FS");
    // Remove region from META
    MetaEditor.deleteRegion(this.server.getCatalogTracker(), region);
    // Delete region from FS
    this.masterServices.getMasterFileSystem().deleteRegion(region);
  }
  // Delete table from FS
  this.masterServices.getMasterFileSystem().deleteTable(tableName);
  // Update table descriptor cache
  this.masterServices.getTableDescriptors().remove(Bytes.toString(tableName));

  // If entry for this table in zk, and up in AssignmentManager, remove it.
  // Call to undisableTable does this. TODO: Make a more formal purge table.
  am.getZKTable().setEnabledTable(Bytes.toString(tableName));
}
 
开发者ID:lifeng5042,项目名称:RStore,代码行数:36,代码来源:DeleteTableHandler.java

示例3: handleTableOperation

import org.apache.hadoop.hbase.master.AssignmentManager; //导入方法依赖的package包/类
@Override
protected void handleTableOperation(List<HRegionInfo> regions)
throws IOException, KeeperException {
  // 1. Wait because of region in transition
  AssignmentManager am = this.masterServices.getAssignmentManager();
  long waitTime = server.getConfiguration().
    getLong("hbase.master.wait.on.region", 5 * 60 * 1000);
  for (HRegionInfo region : regions) {
    long done = System.currentTimeMillis() + waitTime;
    while (System.currentTimeMillis() < done) {
      AssignmentManager.RegionState rs = am.isRegionInTransition(region);
      if (rs == null) break;
      Threads.sleep(waitingTimeForEvents);
      LOG.debug("Waiting on  region to clear regions in transition; " + rs);
    }
    if (am.isRegionInTransition(region) != null) {
      throw new IOException("Waited hbase.master.wait.on.region (" +
        waitTime + "ms) for region to leave region " +
        region.getRegionNameAsString() + " in transitions");
    }
  }

  // 2. Remove regions from META
  LOG.debug("Deleting regions from META");
  MetaEditor.deleteRegions(this.server.getCatalogTracker(), regions);

  // 3. Move the table in /hbase/.tmp
  LOG.debug("Moving table directory to a temp directory");
  MasterFileSystem mfs = this.masterServices.getMasterFileSystem();
  Path tempTableDir = mfs.moveTableToTemp(tableName);

  try {
    // 4. Delete regions from FS (temp directory)
    FileSystem fs = mfs.getFileSystem();
    for (HRegionInfo hri: regions) {
      LOG.debug("Archiving region " + hri.getRegionNameAsString() + " from FS");
      HFileArchiver.archiveRegion(fs, mfs.getRootDir(),
          tempTableDir, new Path(tempTableDir, hri.getEncodedName()));
    }

    // 5. Delete table from FS (temp directory)
    if (!HBaseFileSystem.deleteDirFromFileSystem(fs, tempTableDir)) {
      LOG.error("Couldn't delete " + tempTableDir);
    }
  } finally {
    // 6. Update table descriptor cache
    this.masterServices.getTableDescriptors().remove(Bytes.toString(tableName));

    // 7. If entry for this table in zk, and up in AssignmentManager, remove it.
    am.getZKTable().setDeletedTable(Bytes.toString(tableName));
  }
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:53,代码来源:DeleteTableHandler.java

示例4: handleTableOperation

import org.apache.hadoop.hbase.master.AssignmentManager; //导入方法依赖的package包/类
@Override
protected void handleTableOperation(List<HRegionInfo> regions)
throws IOException, KeeperException {
  MasterCoprocessorHost cpHost = ((HMaster) this.server).getCoprocessorHost();
  if (cpHost != null) {
    cpHost.preDeleteTableHandler(this.tableName);
  }
  // 1. Wait because of region in transition
  AssignmentManager am = this.masterServices.getAssignmentManager();
  long waitTime = server.getConfiguration().
    getLong("hbase.master.wait.on.region", 5 * 60 * 1000);
  for (HRegionInfo region : regions) {
    long done = System.currentTimeMillis() + waitTime;
    while (System.currentTimeMillis() < done) {
      AssignmentManager.RegionState rs = am.isRegionInTransition(region);
      if (rs == null) break;
      Threads.sleep(waitingTimeForEvents);
      LOG.debug("Waiting on  region to clear regions in transition; " + rs);
    }
    if (am.isRegionInTransition(region) != null) {
      throw new IOException("Waited hbase.master.wait.on.region (" +
        waitTime + "ms) for region to leave region " +
        region.getRegionNameAsString() + " in transitions");
    }
  }

  // 2. Remove regions from META
  LOG.debug("Deleting regions from META");
  MetaEditor.deleteRegions(this.server.getCatalogTracker(), regions);

  // 3. Move the table in /hbase/.tmp
  LOG.debug("Moving table directory to a temp directory");
  MasterFileSystem mfs = this.masterServices.getMasterFileSystem();
  Path tempTableDir = mfs.moveTableToTemp(tableName);

  try {
    // 4. Delete regions from FS (temp directory)
    FileSystem fs = mfs.getFileSystem();
    for (HRegionInfo hri: regions) {
      LOG.debug("Archiving region " + hri.getRegionNameAsString() + " from FS");
      HFileArchiver.archiveRegion(fs, mfs.getRootDir(),
          tempTableDir, new Path(tempTableDir, hri.getEncodedName()));
    }

    // 5. Delete table from FS (temp directory)
    if (!HBaseFileSystem.deleteDirFromFileSystem(fs, tempTableDir)) {
      LOG.error("Couldn't delete " + tempTableDir);
    }
  } finally {
    // 6. Update table descriptor cache
    this.masterServices.getTableDescriptors().remove(Bytes.toString(tableName));

    // 7. If entry for this table in zk, and up in AssignmentManager, remove it.
    am.getZKTable().setDeletedTable(Bytes.toString(tableName));
    if (cpHost != null) {
      cpHost.postDeleteTableHandler(this.tableName);
    }
  }
}
 
开发者ID:Huawei-Hadoop,项目名称:hindex,代码行数:60,代码来源:DeleteTableHandler.java


注:本文中的org.apache.hadoop.hbase.master.AssignmentManager.RegionState方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。