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


Java SnapshotDescription.getType方法代码示例

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


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

示例1: buildSubprocedure

import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription; //导入方法依赖的package包/类
/**
 * If in a running state, creates the specified subprocedure for handling an online snapshot.
 *
 * Because this gets the local list of regions to snapshot and not the set the master had,
 * there is a possibility of a race where regions may be missed.  This detected by the master in
 * the snapshot verification step.
 *
 * @param snapshot
 * @return Subprocedure to submit to the ProcedureMemeber.
 */
public Subprocedure buildSubprocedure(SnapshotDescription snapshot) {

  // don't run a snapshot if the parent is stop(ping)
  if (rss.isStopping() || rss.isStopped()) {
    throw new IllegalStateException("Can't start snapshot on RS: " + rss.getServerName()
        + ", because stopping/stopped!");
  }

  // check to see if this server is hosting any regions for the snapshots
  // check to see if we have regions for the snapshot
  List<Region> involvedRegions;
  try {
    involvedRegions = getRegionsToSnapshot(snapshot);
  } catch (IOException e1) {
    throw new IllegalStateException("Failed to figure out if we should handle a snapshot - "
        + "something has gone awry with the online regions.", e1);
  }

  // We need to run the subprocedure even if we have no relevant regions.  The coordinator
  // expects participation in the procedure and without sending message the snapshot attempt
  // will hang and fail.

  LOG.debug("Launching subprocedure for snapshot " + snapshot.getName() + " from table "
      + snapshot.getTable() + " type " + snapshot.getType());
  ForeignExceptionDispatcher exnDispatcher = new ForeignExceptionDispatcher(snapshot.getName());
  Configuration conf = rss.getConfiguration();
  long timeoutMillis = conf.getLong(SNAPSHOT_TIMEOUT_MILLIS_KEY,
      SNAPSHOT_TIMEOUT_MILLIS_DEFAULT);
  long wakeMillis = conf.getLong(SNAPSHOT_REQUEST_WAKE_MILLIS_KEY,
      SNAPSHOT_REQUEST_WAKE_MILLIS_DEFAULT);

  switch (snapshot.getType()) {
  case FLUSH:
    SnapshotSubprocedurePool taskManager =
      new SnapshotSubprocedurePool(rss.getServerName().toString(), conf, rss);
    return new FlushSnapshotSubprocedure(member, exnDispatcher, wakeMillis,
        timeoutMillis, involvedRegions, snapshot, taskManager);
  case SKIPFLUSH:
      /*
       * This is to take an online-snapshot without force a coordinated flush to prevent pause
       * The snapshot type is defined inside the snapshot description. FlushSnapshotSubprocedure
       * should be renamed to distributedSnapshotSubprocedure, and the flush() behavior can be
       * turned on/off based on the flush type.
       * To minimized the code change, class name is not changed.
       */
      SnapshotSubprocedurePool taskManager2 =
          new SnapshotSubprocedurePool(rss.getServerName().toString(), conf, rss);
      return new FlushSnapshotSubprocedure(member, exnDispatcher, wakeMillis,
          timeoutMillis, involvedRegions, snapshot, taskManager2);

  default:
    throw new UnsupportedOperationException("Unrecognized snapshot type:" + snapshot.getType());
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:65,代码来源:RegionServerSnapshotManager.java


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