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


Java CellUtil.setSequenceId方法代码示例

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


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

示例1: stampRegionSequenceId

import org.apache.hadoop.hbase.CellUtil; //导入方法依赖的package包/类
/**
 * Here is where a WAL edit gets its sequenceid.
 * @return The sequenceid we stamped on this edit.
 * @throws IOException
 */
long stampRegionSequenceId() throws IOException {
  long regionSequenceId = WALKey.NO_SEQUENCE_ID;
  MultiVersionConcurrencyControl mvcc = getKey().getMvcc();
  MultiVersionConcurrencyControl.WriteEntry we = null;

  if (mvcc != null) {
    we = mvcc.begin();
    regionSequenceId = we.getWriteNumber();
  }

  if (!this.getEdit().isReplay() && inMemstore) {
    for (Cell c:getEdit().getCells()) {
      CellUtil.setSequenceId(c, regionSequenceId);
    }
  }

  // This has to stay in this order
  WALKey key = getKey();
  key.setLogSeqNum(regionSequenceId);
  key.setWriteEntry(we);
  return regionSequenceId;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:28,代码来源:FSWALEntry.java

示例2: setCurrentCell

import org.apache.hadoop.hbase.CellUtil; //导入方法依赖的package包/类
protected void setCurrentCell(Cell newVal) throws IOException {
  this.cur = newVal;
  if (this.cur != null && this.reader.isBulkLoaded()) {
    CellUtil.setSequenceId(cur, this.reader.getSequenceID());
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:7,代码来源:StoreFileScanner.java

示例3: applyIncrementsToColumnFamily

import org.apache.hadoop.hbase.CellUtil; //导入方法依赖的package包/类
/**
 * Apply increments to a column family.
 *
 * @param sortedIncrements The passed in increments to apply MUST be sorted so that they match the
 *                         order that they appear in the Get results (get results will be sorted on return).
 *                         Otherwise, we won't be able to find the existing values if the cells are not specified
 *                         in order by the client since cells are in an array list.
 * @return Resulting increments after <code>sortedIncrements</code> have been applied to current
 * values (if any -- else passed increment is the final result).
 * @throws IOException
 * @islation Isolation level to use when running the 'get'. Pass null for default.
 */
private List<Cell> applyIncrementsToColumnFamily(Increment increment, byte[] columnFamilyName,
    List<Cell> sortedIncrements, long now, long mvccNum, List<Cell> allKVs,
    final IsolationLevel isolation) throws IOException {
  List<Cell> results = new ArrayList<Cell>(sortedIncrements.size());
  byte[] row = increment.getRow();
  // Get previous values for all columns in this family
  List<Cell> currentValues =
      getIncrementCurrentValue(increment, columnFamilyName, sortedIncrements, isolation);
  // Iterate the input columns and update existing values if they were found,
  // otherwise
  // add new column initialized to the increment amount
  int idx = 0;
  for (int i = 0; i < sortedIncrements.size(); i++) {
    Cell inc = sortedIncrements.get(i);
    long incrementAmount = getLongValue(inc);
    // If increment amount == 0, then don't write this Increment to the WAL.
    boolean writeBack = (incrementAmount != 0);
    // Carry forward any tags that might have been added by a coprocessor.
    List<Tag> tags = Tag.carryForwardTags(inc);

    Cell currentValue = null;
    long ts = now;
    if (idx < currentValues.size() && CellUtil.matchingQualifier(currentValues.get(idx), inc)) {
      currentValue = currentValues.get(idx);
      ts = Math.max(now, currentValue.getTimestamp());
      incrementAmount += getLongValue(currentValue);
      // Carry forward all tags
      tags = Tag.carryForwardTags(tags, currentValue);
      if (i < (sortedIncrements.size() - 1) && !CellUtil
          .matchingQualifier(inc, sortedIncrements.get(i + 1))) idx++;
    }

    // Append new incremented KeyValue to list
    byte[] qualifier = CellUtil.cloneQualifier(inc);
    byte[] incrementAmountInBytes = Bytes.toBytes(incrementAmount);
    tags = carryForwardTTLTag(tags, increment);

    Cell newValue =
        new KeyValue(row, 0, row.length, columnFamilyName, 0, columnFamilyName.length, qualifier,
            0, qualifier.length, ts, KeyValue.Type.Put, incrementAmountInBytes, 0,
            incrementAmountInBytes.length, tags);

    // Don't set an mvcc if none specified. The mvcc may be assigned later in
    // case where we
    // write the memstore AFTER we sync our edit to the log.
    if (mvccNum != MultiVersionConcurrencyControl.NO_WRITE_NUMBER) {
      CellUtil.setSequenceId(newValue, mvccNum);
    }

    // Give coprocessors a chance to update the new cell
    if (coprocessorHost != null) {
      newValue = coprocessorHost
          .postMutationBeforeWAL(RegionObserver.MutationType.INCREMENT, increment, currentValue,
              newValue);
    }
    allKVs.add(newValue);
    if (writeBack) {
      results.add(newValue);
    }
  }
  return results;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:75,代码来源:HRegion.java


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