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


Java MetaEditor.addDaughtersToPut方法代码示例

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


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

示例1: offlineParentInMetaAndputMetaEntries

import org.apache.hadoop.hbase.catalog.MetaEditor; //导入方法依赖的package包/类
private void offlineParentInMetaAndputMetaEntries(CatalogTracker catalogTracker,
    HRegionInfo parent, HRegionInfo splitA, HRegionInfo splitB,
    ServerName serverName, List<Mutation> metaEntries) throws IOException {
  List<Mutation> mutations = metaEntries;
  HRegionInfo copyOfParent = new HRegionInfo(parent);
  copyOfParent.setOffline(true);
  copyOfParent.setSplit(true);

  //Put for parent
  Put putParent = MetaEditor.makePutFromRegionInfo(copyOfParent);
  MetaEditor.addDaughtersToPut(putParent, splitA, splitB);
  mutations.add(putParent);
  
  //Puts for daughters
  Put putA = MetaEditor.makePutFromRegionInfo(splitA);
  Put putB = MetaEditor.makePutFromRegionInfo(splitB);

  addLocation(putA, serverName, 1); //these are new regions, openSeqNum = 1 is fine.
  addLocation(putB, serverName, 1);
  mutations.add(putA);
  mutations.add(putB);
  MetaEditor.mutateMetaTable(catalogTracker, mutations);
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:24,代码来源:SplitTransaction.java

示例2: preSplitBeforePONR

import org.apache.hadoop.hbase.catalog.MetaEditor; //导入方法依赖的package包/类
@Override
public void preSplitBeforePONR(ObserverContext<RegionCoprocessorEnvironment> ctx,
    byte[] splitKey, List<Mutation> metaEntries) throws IOException {
  RegionCoprocessorEnvironment environment = ctx.getEnvironment();
  HRegionServer rs = (HRegionServer) environment.getRegionServerServices();
  List<HRegion> onlineRegions =
      rs.getOnlineRegions(TableName.valueOf("testSplitHooksBeforeAndAfterPONR_2"));
  HRegion region = onlineRegions.get(0);
  for (HRegion r : onlineRegions) {
    if (r.getRegionInfo().containsRow(splitKey)) {
      region = r;
      break;
    }
  }
  st = new SplitTransaction(region, splitKey);
  if (!st.prepare()) {
    LOG.error("Prepare for the table " + region.getTableDesc().getNameAsString()
        + " failed. So returning null. ");
    ctx.bypass();
    return;
  }
  region.forceSplit(splitKey);
  daughterRegions = st.stepsBeforePONR(rs, rs, false);
  HRegionInfo copyOfParent = new HRegionInfo(region.getRegionInfo());
  copyOfParent.setOffline(true);
  copyOfParent.setSplit(true);
  // Put for parent
  Put putParent = MetaEditor.makePutFromRegionInfo(copyOfParent);
  MetaEditor.addDaughtersToPut(putParent, daughterRegions.getFirst().getRegionInfo(),
    daughterRegions.getSecond().getRegionInfo());
  metaEntries.add(putParent);
  // Puts for daughters
  Put putA = MetaEditor.makePutFromRegionInfo(daughterRegions.getFirst().getRegionInfo());
  Put putB = MetaEditor.makePutFromRegionInfo(daughterRegions.getSecond().getRegionInfo());
  st.addLocation(putA, rs.getServerName(), 1);
  st.addLocation(putB, rs.getServerName(), 1);
  metaEntries.add(putA);
  metaEntries.add(putB);
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:40,代码来源:TestSplitTransactionOnCluster.java


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