• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java MergeRegionException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.hadoop.hbase.exceptions.MergeRegionException的典型用法代码示例。如果您正苦于以下问题:Java MergeRegionException类的具体用法?Java MergeRegionException怎么用?Java MergeRegionException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MergeRegionException类属于org.apache.hadoop.hbase.exceptions包,在下文中一共展示了MergeRegionException类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: MergeTableRegionsProcedure

import org.apache.hadoop.hbase.exceptions.MergeRegionException; //导入依赖的package包/类
public MergeTableRegionsProcedure(final MasterProcedureEnv env,
    final RegionInfo[] regionsToMerge, final boolean forcible)
    throws MergeRegionException {
  super(env);

  // Check daughter regions and make sure that we have valid daughter regions
  // before doing the real work.
  checkRegionsToMerge(regionsToMerge, forcible);

  // WARN: make sure there is no parent region of the two merging regions in
  // hbase:meta If exists, fixing up daughters would cause daughter regions(we
  // have merged one) online again when we restart master, so we should clear
  // the parent region to prevent the above case
  // Since HBASE-7721, we don't need fix up daughters any more. so here do nothing
  this.regionsToMerge = regionsToMerge;
  this.mergedRegion = createMergedRegionInfo(regionsToMerge);
  this.forcible = forcible;
}
 
开发者ID:apache,项目名称:hbase,代码行数:19,代码来源:MergeTableRegionsProcedure.java


示例2: checkRegionsToMerge

import org.apache.hadoop.hbase.exceptions.MergeRegionException; //导入依赖的package包/类
private static void checkRegionsToMerge(final RegionInfo regionToMergeA,
    final RegionInfo regionToMergeB, final boolean forcible) throws MergeRegionException {
  if (!regionToMergeA.getTable().equals(regionToMergeB.getTable())) {
    throw new MergeRegionException("Can't merge regions from two different tables: " +
      regionToMergeA + ", " + regionToMergeB);
  }

  if (regionToMergeA.getReplicaId() != RegionInfo.DEFAULT_REPLICA_ID ||
      regionToMergeB.getReplicaId() != RegionInfo.DEFAULT_REPLICA_ID) {
    throw new MergeRegionException("Can't merge non-default replicas");
  }

  if (!RegionInfo.areAdjacent(regionToMergeA, regionToMergeB)) {
    String msg = "Unable to merge not adjacent regions " + regionToMergeA.getShortNameToLog() +
        ", " + regionToMergeB.getShortNameToLog() + " where forcible = " + forcible;
    LOG.warn(msg);
    if (!forcible) {
      throw new MergeRegionException(msg);
    }
  }
}
 
开发者ID:apache,项目名称:hbase,代码行数:22,代码来源:MergeTableRegionsProcedure.java


示例3: mergeRegions

import org.apache.hadoop.hbase.exceptions.MergeRegionException; //导入依赖的package包/类
/**
 * Merge two regions. Asynchronous operation.
 * @param encodedNameOfRegionA encoded name of region a
 * @param encodedNameOfRegionB encoded name of region b
 * @param forcible true if do a compulsory merge, otherwise we will only merge
 *          two adjacent regions
 * @throws IOException
 */
public void mergeRegions(final byte[] encodedNameOfRegionA,
    final byte[] encodedNameOfRegionB, final boolean forcible)
    throws IOException {
  MasterKeepAliveConnection master = connection
      .getKeepAliveMasterService();
  try {
    DispatchMergingRegionsRequest request = RequestConverter
        .buildDispatchMergingRegionsRequest(encodedNameOfRegionA,
            encodedNameOfRegionB, forcible);
    master.dispatchMergingRegions(null, request);
  } catch (ServiceException se) {
    IOException ioe = ProtobufUtil.getRemoteException(se);
    if (ioe instanceof UnknownRegionException) {
      throw (UnknownRegionException) ioe;
    }
    if (ioe instanceof MergeRegionException) {
      throw (MergeRegionException) ioe;
    }
    LOG.error("Unexpected exception: " + se
        + " from calling HMaster.dispatchMergingRegions");
  } catch (DeserializationException de) {
    LOG.error("Could not parse destination server name: " + de);
  } finally {
    master.close();
  }
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:35,代码来源:HBaseAdmin.java


示例4: dispatchMergingRegions

import org.apache.hadoop.hbase.exceptions.MergeRegionException; //导入依赖的package包/类
@Override
public DispatchMergingRegionsResponse dispatchMergingRegions(
    RpcController controller, DispatchMergingRegionsRequest request)
    throws ServiceException {
  final byte[] encodedNameOfRegionA = request.getRegionA().getValue()
      .toByteArray();
  final byte[] encodedNameOfRegionB = request.getRegionB().getValue()
      .toByteArray();
  final boolean forcible = request.getForcible();
  if (request.getRegionA().getType() != RegionSpecifierType.ENCODED_REGION_NAME
      || request.getRegionB().getType() != RegionSpecifierType.ENCODED_REGION_NAME) {
    LOG.warn("mergeRegions specifier type: expected: "
        + RegionSpecifierType.ENCODED_REGION_NAME + " actual: region_a="
        + request.getRegionA().getType() + ", region_b="
        + request.getRegionB().getType());
  }
  RegionState regionStateA = assignmentManager.getRegionStates()
      .getRegionState(Bytes.toString(encodedNameOfRegionA));
  RegionState regionStateB = assignmentManager.getRegionStates()
      .getRegionState(Bytes.toString(encodedNameOfRegionB));
  if (regionStateA == null || regionStateB == null) {
    throw new ServiceException(new UnknownRegionException(
        Bytes.toStringBinary(regionStateA == null ? encodedNameOfRegionA
            : encodedNameOfRegionB)));
  }

  if (!regionStateA.isOpened() || !regionStateB.isOpened()) {
    throw new ServiceException(new MergeRegionException(
      "Unable to merge regions not online " + regionStateA + ", " + regionStateB));
  }

  HRegionInfo regionInfoA = regionStateA.getRegion();
  HRegionInfo regionInfoB = regionStateB.getRegion();
  if (regionInfoA.compareTo(regionInfoB) == 0) {
    throw new ServiceException(new MergeRegionException(
      "Unable to merge a region to itself " + regionInfoA + ", " + regionInfoB));
  }

  if (!forcible && !HRegionInfo.areAdjacent(regionInfoA, regionInfoB)) {
    throw new ServiceException(new MergeRegionException(
      "Unable to merge not adjacent regions "
        + regionInfoA.getRegionNameAsString() + ", "
        + regionInfoB.getRegionNameAsString()
        + " where forcible = " + forcible));
  }

  try {
    dispatchMergingRegions(regionInfoA, regionInfoB, forcible);
  } catch (IOException ioe) {
    throw new ServiceException(ioe);
  }

  return DispatchMergingRegionsResponse.newBuilder().build();
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:55,代码来源:HMaster.java


示例5: mergeRegions

import org.apache.hadoop.hbase.exceptions.MergeRegionException; //导入依赖的package包/类
@Override
public long mergeRegions(
    final RegionInfo[] regionsToMerge,
    final boolean forcible,
    final long nonceGroup,
    final long nonce) throws IOException {
  checkInitialized();

  assert(regionsToMerge.length == 2);

  TableName tableName = regionsToMerge[0].getTable();
  if (tableName == null || regionsToMerge[1].getTable() == null) {
    throw new UnknownRegionException ("Can't merge regions without table associated");
  }

  if (!tableName.equals(regionsToMerge[1].getTable())) {
    throw new IOException (
      "Cannot merge regions from two different tables " + regionsToMerge[0].getTable()
      + " and " + regionsToMerge[1].getTable());
  }

  if (RegionInfo.COMPARATOR.compare(regionsToMerge[0], regionsToMerge[1]) == 0) {
    throw new MergeRegionException(
      "Cannot merge a region to itself " + regionsToMerge[0] + ", " + regionsToMerge[1]);
  }

  return MasterProcedureUtil.submitProcedure(
      new MasterProcedureUtil.NonceProcedureRunnable(this, nonceGroup, nonce) {
    @Override
    protected void run() throws IOException {
      getMaster().getMasterCoprocessorHost().preMergeRegions(regionsToMerge);

      LOG.info(getClientIdAuditPrefix() + " Merge regions " +
        regionsToMerge[0].getEncodedName() + " and " + regionsToMerge[1].getEncodedName());

      submitProcedure(new MergeTableRegionsProcedure(procedureExecutor.getEnvironment(),
        regionsToMerge, forcible));

      getMaster().getMasterCoprocessorHost().postMergeRegions(regionsToMerge);
    }

    @Override
    protected String getDescription() {
      return "MergeTableProcedure";
    }
  });
}
 
开发者ID:apache,项目名称:hbase,代码行数:48,代码来源:HMaster.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java GraphPath类代码示例发布时间:2022-05-22
下一篇:
Java Linq4j类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap