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


Java MetaEditor.deleteRegions方法代码示例

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


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

示例1: removeTableData

import org.apache.hadoop.hbase.catalog.MetaEditor; //导入方法依赖的package包/类
/**
 * Removes the table from .META. and archives the HDFS files.
 */
protected void removeTableData(final List<HRegionInfo> regions)
    throws IOException, CoordinatedStateException {
  // 1. Remove regions from META
  LOG.debug("Deleting regions from META");
  MetaEditor.deleteRegions(this.server.getCatalogTracker(), regions);

  // -----------------------------------------------------------------------
  // NOTE: At this point we still have data on disk, but nothing in .META.
  //       if the rename below fails, hbck will report an inconsistency.
  // -----------------------------------------------------------------------

  // 2. Move the table in /hbase/.tmp
  MasterFileSystem mfs = this.masterServices.getMasterFileSystem();
  Path tempTableDir = mfs.moveTableToTemp(tableName);

  // 3. Archive 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, HRegion.getRegionDir(tempTableDir, hri.getEncodedName()));
  }

  // 4. Delete table directory from FS (temp directory)
  if (!fs.delete(tempTableDir, true)) {
    LOG.error("Couldn't delete " + tempTableDir);
  }

  LOG.debug("Table '" + tableName + "' archived!");
}
 
开发者ID:shenli-uiuc,项目名称:PyroDB,代码行数:34,代码来源:DeleteTableHandler.java

示例2: handleTableOperation

import org.apache.hadoop.hbase.catalog.MetaEditor; //导入方法依赖的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

示例3: handleTableOperation

import org.apache.hadoop.hbase.catalog.MetaEditor; //导入方法依赖的package包/类
/**
 * The restore table is executed in place.
 *  - The on-disk data will be restored - reference files are put in place without moving data
 *  -  [if something fail here: you need to delete the table and re-run the restore]
 *  - META will be updated
 *  -  [if something fail here: you need to run hbck to fix META entries]
 * The passed in list gets changed in this method
 */
@Override
protected void handleTableOperation(List<HRegionInfo> hris) throws IOException {
  MasterFileSystem fileSystemManager = masterServices.getMasterFileSystem();
  CatalogTracker catalogTracker = masterServices.getCatalogTracker();
  FileSystem fs = fileSystemManager.getFileSystem();
  Path rootDir = fileSystemManager.getRootDir();
  byte[] tableName = hTableDescriptor.getName();
  Path tableDir = HTableDescriptor.getTableDir(rootDir, tableName);

  try {
    // 1. Update descriptor
    this.masterServices.getTableDescriptors().add(hTableDescriptor);

    // 2. Execute the on-disk Restore
    LOG.debug("Starting restore snapshot=" + SnapshotDescriptionUtils.toString(snapshot));
    Path snapshotDir = SnapshotDescriptionUtils.getCompletedSnapshotDir(snapshot, rootDir);
    RestoreSnapshotHelper restoreHelper = new RestoreSnapshotHelper(
        masterServices.getConfiguration(), fs,
        snapshot, snapshotDir, hTableDescriptor, tableDir, monitor, status);
    RestoreSnapshotHelper.RestoreMetaChanges metaChanges = restoreHelper.restoreHdfsRegions();

    // 3. Forces all the RegionStates to be offline
    //
    // The AssignmentManager keeps all the region states around
    // with no possibility to remove them, until the master is restarted.
    // This means that a region marked as SPLIT before the restore will never be assigned again.
    // To avoid having all states around all the regions are switched to the OFFLINE state,
    // which is the same state that the regions will be after a delete table.
    forceRegionsOffline(metaChanges);
    forceRegionsOffline(metaChanges);

    // 4. Applies changes to .META.

    // 4.1 Removes the current set of regions from META
    //
    // By removing also the regions to restore (the ones present both in the snapshot
    // and in the current state) we ensure that no extra fields are present in META
    // e.g. with a simple add addRegionToMeta() the splitA and splitB attributes
    // not overwritten/removed, so you end up with old informations
    // that are not correct after the restore.
    List<HRegionInfo> hrisToRemove = new LinkedList<HRegionInfo>();
    if (metaChanges.hasRegionsToRemove()) hrisToRemove.addAll(metaChanges.getRegionsToRemove());
    MetaEditor.deleteRegions(catalogTracker, hrisToRemove);

    // 4.2 Add the new set of regions to META
    //
    // At this point the old regions are no longer present in META.
    // and the set of regions present in the snapshot will be written to META.
    // All the information in META are coming from the .regioninfo of each region present
    // in the snapshot folder.
    hris.clear();
    if (metaChanges.hasRegionsToAdd()) hris.addAll(metaChanges.getRegionsToAdd());
    MetaEditor.addRegionsToMeta(catalogTracker, hris);
    if (metaChanges.hasRegionsToRestore()) {
      MetaEditor.overwriteRegions(catalogTracker, metaChanges.getRegionsToRestore());
    }
    metaChanges.updateMetaParentRegions(catalogTracker, hris);

    // At this point the restore is complete. Next step is enabling the table.
    LOG.info("Restore snapshot=" + SnapshotDescriptionUtils.toString(snapshot) + " on table=" +
      Bytes.toString(tableName) + " completed!");
  } catch (IOException e) {
    String msg = "restore snapshot=" + SnapshotDescriptionUtils.toString(snapshot)
        + " failed. Try re-running the restore command.";
    LOG.error(msg, e);
    monitor.receive(new ForeignException(masterServices.getServerName().toString(), e));
    throw new RestoreSnapshotException(msg, e);
  } finally {
    this.stopped = true;
  }
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:80,代码来源:RestoreSnapshotHandler.java

示例4: handleTableOperation

import org.apache.hadoop.hbase.catalog.MetaEditor; //导入方法依赖的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();
  RegionStates states = am.getRegionStates();
  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) {
      if (states.isRegionInState(region, State.FAILED_OPEN)) {
        am.regionOffline(region);
      }
      if (!states.isRegionInTransition(region)) break;
      Threads.sleep(waitingTimeForEvents);
      LOG.debug("Waiting on region to clear regions in transition; "
        + am.getRegionStates().getRegionTransitionState(region));
    }
    if (states.isRegionInTransition(region)) {
      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
  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 (!fs.delete(tempTableDir, true)) {
      LOG.error("Couldn't delete " + tempTableDir);
    }

    LOG.debug("Table '" + tableName + "' archived!");
  } finally {
    // 6. Update table descriptor cache
    LOG.debug("Removing '" + tableName + "' descriptor.");
    this.masterServices.getTableDescriptors().remove(tableName);

    // 7. Clean up regions of the table in RegionStates.
    LOG.debug("Removing '" + tableName + "' from region states.");
    states.tableDeleted(tableName);

    // 8. If entry for this table in zk, and up in AssignmentManager, remove it.
    LOG.debug("Marking '" + tableName + "' as deleted.");
    am.getZKTable().setDeletedTable(tableName);
  }

  if (cpHost != null) {
    cpHost.postDeleteTableHandler(this.tableName);
  }
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:74,代码来源:DeleteTableHandler.java

示例5: handleTableOperation

import org.apache.hadoop.hbase.catalog.MetaEditor; //导入方法依赖的package包/类
/**
 * The restore table is executed in place.
 *  - The on-disk data will be restored - reference files are put in place without moving data
 *  -  [if something fail here: you need to delete the table and re-run the restore]
 *  - hbase:meta will be updated
 *  -  [if something fail here: you need to run hbck to fix hbase:meta entries]
 * The passed in list gets changed in this method
 */
@Override
protected void handleTableOperation(List<HRegionInfo> hris) throws IOException {
  MasterFileSystem fileSystemManager = masterServices.getMasterFileSystem();
  CatalogTracker catalogTracker = masterServices.getCatalogTracker();
  FileSystem fs = fileSystemManager.getFileSystem();
  Path rootDir = fileSystemManager.getRootDir();
  TableName tableName = hTableDescriptor.getTableName();

  try {
    // 1. Update descriptor
    this.masterServices.getTableDescriptors().add(hTableDescriptor);

    // 2. Execute the on-disk Restore
    LOG.debug("Starting restore snapshot=" + ClientSnapshotDescriptionUtils.toString(snapshot));
    Path snapshotDir = SnapshotDescriptionUtils.getCompletedSnapshotDir(snapshot, rootDir);
    RestoreSnapshotHelper restoreHelper = new RestoreSnapshotHelper(
        masterServices.getConfiguration(), fs,
        snapshot, snapshotDir, hTableDescriptor, rootDir, monitor, status);
    RestoreSnapshotHelper.RestoreMetaChanges metaChanges = restoreHelper.restoreHdfsRegions();

    // 3. Forces all the RegionStates to be offline
    //
    // The AssignmentManager keeps all the region states around
    // with no possibility to remove them, until the master is restarted.
    // This means that a region marked as SPLIT before the restore will never be assigned again.
    // To avoid having all states around all the regions are switched to the OFFLINE state,
    // which is the same state that the regions will be after a delete table.
    forceRegionsOffline(metaChanges);

    // 4. Applies changes to hbase:meta
    status.setStatus("Preparing to restore each region");

    // 4.1 Removes the current set of regions from META
    //
    // By removing also the regions to restore (the ones present both in the snapshot
    // and in the current state) we ensure that no extra fields are present in META
    // e.g. with a simple add addRegionToMeta() the splitA and splitB attributes
    // not overwritten/removed, so you end up with old informations
    // that are not correct after the restore.
    List<HRegionInfo> hrisToRemove = new LinkedList<HRegionInfo>();
    if (metaChanges.hasRegionsToRemove()) hrisToRemove.addAll(metaChanges.getRegionsToRemove());
    MetaEditor.deleteRegions(catalogTracker, hrisToRemove);

    // 4.2 Add the new set of regions to META
    //
    // At this point the old regions are no longer present in META.
    // and the set of regions present in the snapshot will be written to META.
    // All the information in hbase:meta are coming from the .regioninfo of each region present
    // in the snapshot folder.
    hris.clear();
    if (metaChanges.hasRegionsToAdd()) hris.addAll(metaChanges.getRegionsToAdd());
    MetaEditor.addRegionsToMeta(catalogTracker, hris);
    if (metaChanges.hasRegionsToRestore()) {
      MetaEditor.overwriteRegions(catalogTracker, metaChanges.getRegionsToRestore());
    }
    metaChanges.updateMetaParentRegions(catalogTracker, hris);

    // At this point the restore is complete. Next step is enabling the table.
    LOG.info("Restore snapshot=" + ClientSnapshotDescriptionUtils.toString(snapshot) +
      " on table=" + tableName + " completed!");
  } catch (IOException e) {
    String msg = "restore snapshot=" + ClientSnapshotDescriptionUtils.toString(snapshot)
        + " failed. Try re-running the restore command.";
    LOG.error(msg, e);
    monitor.receive(new ForeignException(masterServices.getServerName().toString(), e));
    throw new RestoreSnapshotException(msg, e);
  }
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:77,代码来源:RestoreSnapshotHandler.java

示例6: handleTableOperation

import org.apache.hadoop.hbase.catalog.MetaEditor; //导入方法依赖的package包/类
/**
 * The restore table is executed in place.
 *  - The on-disk data will be restored - reference files are put in place without moving data
 *  -  [if something fail here: you need to delete the table and re-run the restore]
 *  - hbase:meta will be updated
 *  -  [if something fail here: you need to run hbck to fix hbase:meta entries]
 * The passed in list gets changed in this method
 */
@Override
protected void handleTableOperation(List<HRegionInfo> hris) throws IOException {
  MasterFileSystem fileSystemManager = masterServices.getMasterFileSystem();
  CatalogTracker catalogTracker = masterServices.getCatalogTracker();
  FileSystem fs = fileSystemManager.getFileSystem();
  Path rootDir = fileSystemManager.getRootDir();
  TableName tableName = hTableDescriptor.getTableName();

  try {
    // 1. Update descriptor
    this.masterServices.getTableDescriptors().add(hTableDescriptor);

    // 2. Execute the on-disk Restore
    LOG.debug("Starting restore snapshot=" + ClientSnapshotDescriptionUtils.toString(snapshot));
    Path snapshotDir = SnapshotDescriptionUtils.getCompletedSnapshotDir(snapshot, rootDir);
    SnapshotManifest manifest = SnapshotManifest.open(masterServices.getConfiguration(), fs,
                                                      snapshotDir, snapshot);
    RestoreSnapshotHelper restoreHelper = new RestoreSnapshotHelper(
        masterServices.getConfiguration(), fs, manifest,
        this.hTableDescriptor, rootDir, monitor, status);
    RestoreSnapshotHelper.RestoreMetaChanges metaChanges = restoreHelper.restoreHdfsRegions();

    // 3. Forces all the RegionStates to be offline
    //
    // The AssignmentManager keeps all the region states around
    // with no possibility to remove them, until the master is restarted.
    // This means that a region marked as SPLIT before the restore will never be assigned again.
    // To avoid having all states around all the regions are switched to the OFFLINE state,
    // which is the same state that the regions will be after a delete table.
    forceRegionsOffline(metaChanges);

    // 4. Applies changes to hbase:meta
    status.setStatus("Preparing to restore each region");

    // 4.1 Removes the current set of regions from META
    //
    // By removing also the regions to restore (the ones present both in the snapshot
    // and in the current state) we ensure that no extra fields are present in META
    // e.g. with a simple add addRegionToMeta() the splitA and splitB attributes
    // not overwritten/removed, so you end up with old informations
    // that are not correct after the restore.
    List<HRegionInfo> hrisToRemove = new LinkedList<HRegionInfo>();
    if (metaChanges.hasRegionsToRemove()) hrisToRemove.addAll(metaChanges.getRegionsToRemove());
    MetaEditor.deleteRegions(catalogTracker, hrisToRemove);

    // 4.2 Add the new set of regions to META
    //
    // At this point the old regions are no longer present in META.
    // and the set of regions present in the snapshot will be written to META.
    // All the information in hbase:meta are coming from the .regioninfo of each region present
    // in the snapshot folder.
    hris.clear();
    if (metaChanges.hasRegionsToAdd()) hris.addAll(metaChanges.getRegionsToAdd());
    MetaEditor.addRegionsToMeta(catalogTracker, hris);
    if (metaChanges.hasRegionsToRestore()) {
      MetaEditor.overwriteRegions(catalogTracker, metaChanges.getRegionsToRestore());
    }
    metaChanges.updateMetaParentRegions(catalogTracker, hris);

    // At this point the restore is complete. Next step is enabling the table.
    LOG.info("Restore snapshot=" + ClientSnapshotDescriptionUtils.toString(snapshot) +
      " on table=" + tableName + " completed!");
  } catch (IOException e) {
    String msg = "restore snapshot=" + ClientSnapshotDescriptionUtils.toString(snapshot)
        + " failed. Try re-running the restore command.";
    LOG.error(msg, e);
    monitor.receive(new ForeignException(masterServices.getServerName().toString(), e));
    throw new RestoreSnapshotException(msg, e);
  }
}
 
开发者ID:shenli-uiuc,项目名称:PyroDB,代码行数:79,代码来源:RestoreSnapshotHandler.java

示例7: handleTableOperation

import org.apache.hadoop.hbase.catalog.MetaEditor; //导入方法依赖的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();
  RegionStates states = am.getRegionStates();
  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) {
      if (states.isRegionInState(region, State.FAILED_OPEN)) {
        am.regionOffline(region);
      }
      if (!states.isRegionInTransition(region)) break;
      Threads.sleep(waitingTimeForEvents);
      LOG.debug("Waiting on region to clear regions in transition; "
        + am.getRegionStates().getRegionTransitionState(region));
    }
    if (states.isRegionInTransition(region)) {
      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
  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 (!fs.delete(tempTableDir, true)) {
      LOG.error("Couldn't delete " + tempTableDir);
    }

    LOG.debug("Table '" + tableName + "' archived!");
  } finally {
    // 6. Update table descriptor cache
    LOG.debug("Removing '" + tableName + "' descriptor.");
    this.masterServices.getTableDescriptors().remove(tableName);

    // 7. If entry for this table in zk, and up in AssignmentManager, remove it.
    LOG.debug("Marking '" + tableName + "' as deleted.");
    am.getZKTable().setDeletedTable(tableName);
  }

  if (cpHost != null) {
    cpHost.postDeleteTableHandler(this.tableName);
  }
}
 
开发者ID:cloud-software-foundation,项目名称:c5,代码行数:70,代码来源:DeleteTableHandler.java

示例8: handleTableOperation

import org.apache.hadoop.hbase.catalog.MetaEditor; //导入方法依赖的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.catalog.MetaEditor.deleteRegions方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。