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


Java CellUtil.isDeleteFamily方法代码示例

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


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

示例1: appendDeleteFamilyBloomFilter

import org.apache.hadoop.hbase.CellUtil; //导入方法依赖的package包/类
private void appendDeleteFamilyBloomFilter(final Cell cell) throws IOException {
  if (!CellUtil.isDeleteFamily(cell) && !CellUtil.isDeleteFamilyVersion(cell)) {
    return;
  }

  // increase the number of delete family in the store file
  deleteFamilyCnt++;
  if (null != this.deleteFamilyBloomFilterWriter) {
    boolean newKey = true;
    if (lastDeleteFamilyCell != null) {
      newKey = !kvComparator.matchingRows(cell, lastDeleteFamilyCell);
    }
    if (newKey) {
      this.deleteFamilyBloomFilterWriter
          .add(cell.getRowArray(), cell.getRowOffset(), cell.getRowLength());
      this.lastDeleteFamilyCell = cell;
    }
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:20,代码来源:StoreFile.java

示例2: isDeleted

import org.apache.hadoop.hbase.CellUtil; //导入方法依赖的package包/类
/**
 * Check if the specified KeyValue buffer has been deleted by a previously
 * seen delete.
 * @param kv
 * @param ds
 * @return True is the specified KeyValue is deleted, false if not
 */
public boolean isDeleted(final Cell kv, final NavigableSet<KeyValue> ds) {
  if (deletes == null || deletes.isEmpty()) return false;
  for (KeyValue d: ds) {
    long kvts = kv.getTimestamp();
    long dts = d.getTimestamp();
    if (CellUtil.isDeleteFamily(d)) {
      if (kvts <= dts) return true;
      continue;
    }
    // Check column
    int ret = Bytes.compareTo(kv.getQualifierArray(), kv.getQualifierOffset(),
        kv.getQualifierLength(),
      d.getQualifierArray(), d.getQualifierOffset(), d.getQualifierLength());
    if (ret <= -1) {
      // This delete is for an earlier column.
      continue;
    } else if (ret >= 1) {
      // Beyond this kv.
      break;
    }
    // Check Timestamp
    if (kvts > dts) return false;

    // Check Type
    switch (KeyValue.Type.codeToType(d.getType())) {
      case Delete: return kvts == dts;
      case DeleteColumn: return true;
      default: continue;
    }
  }
  return false;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:40,代码来源:GetClosestRowBeforeTracker.java

示例3: requestSeek

import org.apache.hadoop.hbase.CellUtil; //导入方法依赖的package包/类
/**
 * Pretend we have done a seek but don't do it yet, if possible. The hope is
 * that we find requested columns in more recent files and won't have to seek
 * in older files. Creates a fake key/value with the given row/column and the
 * highest (most recent) possible timestamp we might get from this file. When
 * users of such "lazy scanner" need to know the next KV precisely (e.g. when
 * this scanner is at the top of the heap), they run {@link #enforceSeek()}.
 * Note that this function does guarantee that the current KV of this scanner
 * will be advanced to at least the given KV. Because of this, it does have
 * to do a real seek in cases when the seek timestamp is older than the
 * highest timestamp of the file, e.g. when we are trying to seek to the next
 * row/column and use OLDEST_TIMESTAMP in the seek key.
 */
@Override public boolean requestSeek(Cell kv, boolean forward, boolean useBloom)
    throws IOException {
  if (kv.getFamilyLength() == 0) {
    useBloom = false;
  }

  boolean haveToSeek = true;
  if (useBloom) {
    // check ROWCOL Bloom filter first.
    if (reader.getBloomFilterType() == BloomType.ROWCOL) {
      haveToSeek = reader
          .passesGeneralBloomFilter(kv.getRowArray(), kv.getRowOffset(), kv.getRowLength(),
              kv.getQualifierArray(), kv.getQualifierOffset(), kv.getQualifierLength());
    } else if (this.matcher != null && !matcher.hasNullColumnInQuery() && ((
        CellUtil.isDeleteFamily(kv) || CellUtil.isDeleteFamilyVersion(kv)))) {
      // if there is no such delete family kv in the store file,
      // then no need to seek.
      haveToSeek = reader
          .passesDeleteFamilyBloomFilter(kv.getRowArray(), kv.getRowOffset(), kv.getRowLength());
    }
  }

  delayedReseek = forward;
  delayedSeekKV = kv;

  if (haveToSeek) {
    // This row/column might be in this store file (or we did not use the
    // Bloom filter), so we still need to seek.
    realSeekDone = false;
    long maxTimestampInFile = reader.getMaxTimestamp();
    long seekTimestamp = kv.getTimestamp();
    if (seekTimestamp > maxTimestampInFile) {
      // Create a fake key that is not greater than the real next key.
      // (Lower timestamps correspond to higher KVs.)
      // To understand this better, consider that we are asked to seek to
      // a higher timestamp than the max timestamp in this file. We know that
      // the next point when we have to consider this file again is when we
      // pass the max timestamp of this file (with the same row/column).
      setCurrentCell(KeyValueUtil.createFirstOnRowColTS(kv, maxTimestampInFile));
    } else {
      // This will be the case e.g. when we need to seek to the next
      // row/column, and we don't know exactly what they are, so we set the
      // seek key's timestamp to OLDEST_TIMESTAMP to skip the rest of this
      // row/column.
      enforceSeek();
    }
    return cur != null;
  }

  // Multi-column Bloom filter optimization.
  // Create a fake key/value, so that this scanner only bubbles up to the top
  // of the KeyValueHeap in StoreScanner after we scanned this row/column in
  // all other store files. The query matcher will then just skip this fake
  // key/value and the store scanner will progress to the next column. This
  // is obviously not a "real real" seek, but unlike the fake KV earlier in
  // this method, we want this to be propagated to ScanQueryMatcher.
  setCurrentCell(KeyValueUtil.createLastOnRowCol(kv));

  realSeekDone = true;
  return true;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:75,代码来源:StoreFileScanner.java


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