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

Java HRegionInfo090x类代码示例

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

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



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

示例1: visit

import org.apache.hadoop.hbase.migration.HRegionInfo090x; //导入依赖的package包/类
@Override
public boolean visit(Result r) throws IOException {
  if (r ==  null || r.isEmpty()) return true;
  // Check info:regioninfo, info:splitA, and info:splitB.  Make sure all
  // have migrated HRegionInfos... that there are no leftover 090 version
  // HRegionInfos.
  byte [] hriBytes = getBytes(r, HConstants.REGIONINFO_QUALIFIER);
  // Presumes that an edit updating all three cells either succeeds or
  // doesn't -- that we don't have case of info:regioninfo migrated but not
  // info:splitA.
  if (isMigrated(hriBytes)) return true;
  // OK. Need to migrate this row in meta.
  HRegionInfo090x hri090 = getHRegionInfo090x(hriBytes);
  HTableDescriptor htd = hri090.getTableDesc();
  if (htd == null) {
    LOG.warn("A 090 HRI has null HTD? Continuing; " + hri090.toString());
    return true;
  }
  if (!this.htds.contains(htd)) {
    // If first time we are adding a table, then write it out to fs.
    // Presumes that first region in table has THE table's schema which
    // might not be too bad of a presumption since it'll be first region
    // 'altered'
    this.services.getMasterFileSystem().createTableDescriptor(htd);
    this.htds.add(htd);
  }
  // This will 'migrate' the hregioninfo from 090 version to 092.
  HRegionInfo hri = new HRegionInfo(hri090);
  // Now make a put to write back to meta.
  Put p = new Put(hri.getRegionName());
  p.add(HConstants.CATALOG_FAMILY, HConstants.REGIONINFO_QUALIFIER,
    Writables.getBytes(hri));
  // Now check info:splitA and info:splitB if present.  Migrate these too.
  checkSplit(r, p, HConstants.SPLITA_QUALIFIER);
  checkSplit(r, p, HConstants.SPLITB_QUALIFIER);
  // Below we fake out putToCatalogTable
  MetaEditor.putToCatalogTable(this.services.getCatalogTracker(), p);
  LOG.info("Migrated " + Bytes.toString(p.getRow()));
  return true;
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:41,代码来源:MetaMigrationRemovingHTD.java


示例2: get090HRI

import org.apache.hadoop.hbase.migration.HRegionInfo090x; //导入依赖的package包/类
/**
 * @param r Result to look in.
 * @param qualifier What to look at in the passed result.
 * @return Either a 090 vintage HRegionInfo OR null if no HRegionInfo or
 * the HRegionInfo is up to date and not in need of migration.
 * @throws IOException
 */
static HRegionInfo090x get090HRI(final Result r, final byte [] qualifier)
throws IOException {
  byte [] hriBytes = r.getValue(HConstants.CATALOG_FAMILY, qualifier);
  if (hriBytes == null || hriBytes.length <= 0) return null;
  if (isMigrated(hriBytes)) return null;
  return getHRegionInfo090x(hriBytes);
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:15,代码来源:MetaMigrationRemovingHTD.java


示例3: HRegionInfo

import org.apache.hadoop.hbase.migration.HRegionInfo090x; //导入依赖的package包/类
/**
 * Used only for migration
 * @param other HRegionInfoForMigration
 */
public HRegionInfo(HRegionInfo090x other) {
  super();
  this.endKey = other.getEndKey();
  this.offLine = other.isOffline();
  this.regionId = other.getRegionId();
  this.regionName = other.getRegionName();
  this.regionNameStr = Bytes.toStringBinary(this.regionName);
  this.split = other.isSplit();
  this.startKey = other.getStartKey();
  this.hashCode = other.hashCode();
  this.encodedName = other.getEncodedName();
  this.tableName = other.getTableDesc().getName();
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:18,代码来源:HRegionInfo.java


示例4: createMultiRegionsWithLegacyHRI

import org.apache.hadoop.hbase.migration.HRegionInfo090x; //导入依赖的package包/类
/**
 * @param c
 * @param htd
 * @param columnFamily
 * @param startKeys
 * @return
 * @throws IOException
 * @deprecated Just for testing migration of meta from 0.90 to 0.92... will be
 * removed thereafter
 */
public int createMultiRegionsWithLegacyHRI(final Configuration c,
    final HTableDescriptor htd, final byte[] columnFamily, byte [][] startKeys)
throws IOException {
  Arrays.sort(startKeys, Bytes.BYTES_COMPARATOR);
  HTable meta = new HTable(c, HConstants.META_TABLE_NAME);
  if(!htd.hasFamily(columnFamily)) {
    HColumnDescriptor hcd = new HColumnDescriptor(columnFamily);
    htd.addFamily(hcd);
  }
  List<HRegionInfo090x> newRegions
      = new ArrayList<HRegionInfo090x>(startKeys.length);
  int count = 0;
  for (int i = 0; i < startKeys.length; i++) {
    int j = (i + 1) % startKeys.length;
    HRegionInfo090x hri = new HRegionInfo090x(htd,
      startKeys[i], startKeys[j]);
    Put put = new Put(hri.getRegionName());
    put.setWriteToWAL(false);
    put.add(HConstants.CATALOG_FAMILY, HConstants.REGIONINFO_QUALIFIER,
      Writables.getBytes(hri));
    meta.put(put);
    LOG.info("createMultiRegions: PUT inserted " + hri.toString());

    newRegions.add(hri);
    count++;
  }
  meta.close();
  return count;
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:40,代码来源:TestMetaMigrationRemovingHTD.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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