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


Java CellUtil.getCellKeyAsString方法代码示例

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


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

示例1: assertBulkLoadHFileOk

import org.apache.hadoop.hbase.CellUtil; //导入方法依赖的package包/类
@Override public void assertBulkLoadHFileOk(Path srcPath) throws IOException {
  HFile.Reader reader = null;
  try {
    LOG.info(
        "Validating hfile at " + srcPath + " for inclusion in " + "store " + this + " region "
            + this.getRegionInfo().getRegionNameAsString());
    reader = HFile.createReader(srcPath.getFileSystem(conf), srcPath, cacheConf, conf);
    reader.loadFileInfo();

    byte[] firstKey = reader.getFirstRowKey();
    Preconditions.checkState(firstKey != null, "First key can not be null");
    byte[] lk = reader.getLastKey();
    Preconditions.checkState(lk != null, "Last key can not be null");
    byte[] lastKey = KeyValue.createKeyValueFromKey(lk).getRow();

    LOG.debug("HFile bounds: first=" + Bytes.toStringBinary(firstKey) + " last=" + Bytes
        .toStringBinary(lastKey));
    LOG.debug(
        "Region bounds: first=" + Bytes.toStringBinary(getRegionInfo().getStartKey()) + " last="
            + Bytes.toStringBinary(getRegionInfo().getEndKey()));

    if (!this.getRegionInfo().containsRange(firstKey, lastKey)) {
      throw new WrongRegionException(
          "Bulk load file " + srcPath.toString() + " does not fit inside region " + this
              .getRegionInfo().getRegionNameAsString());
    }

    if (reader.length() > conf
        .getLong(HConstants.HREGION_MAX_FILESIZE, HConstants.DEFAULT_MAX_FILE_SIZE)) {
      LOG.warn(
          "Trying to bulk load hfile " + srcPath.toString() + " with size: " + reader.length()
              + " bytes can be problematic as it may lead to oversplitting.");
    }

    if (verifyBulkLoads) {
      long verificationStartTime = EnvironmentEdgeManager.currentTime();
      LOG.info("Full verification started for bulk load hfile: " + srcPath.toString());
      Cell prevCell = null;
      HFileScanner scanner = reader.getScanner(false, false, false);
      scanner.seekTo();
      do {
        Cell cell = scanner.getKeyValue();
        if (prevCell != null) {
          if (CellComparator.compareRows(prevCell, cell) > 0) {
            throw new InvalidHFileException(
                "Previous row is greater than" + " current row: path=" + srcPath + " previous="
                    + CellUtil.getCellKeyAsString(prevCell) + " current=" + CellUtil
                    .getCellKeyAsString(cell));
          }
          if (CellComparator.compareFamilies(prevCell, cell) != 0) {
            throw new InvalidHFileException(
                "Previous key had different" + " family compared to current key: path=" + srcPath
                    + " previous=" + Bytes
                    .toStringBinary(prevCell.getFamilyArray(), prevCell.getFamilyOffset(),
                        prevCell.getFamilyLength()) + " current=" + Bytes
                    .toStringBinary(cell.getFamilyArray(), cell.getFamilyOffset(),
                        cell.getFamilyLength()));
          }
        }
        prevCell = cell;
      } while (scanner.next());
      LOG.info(
          "Full verification complete for bulk load hfile: " + srcPath.toString() + " took " + (
              EnvironmentEdgeManager.currentTime() - verificationStartTime) + " ms");
    }
  } finally {
    if (reader != null) reader.close();
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:70,代码来源:HStore.java


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