org.apache.hadoop.hbase.Cell.heapSize()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(5.8k)|赞(0)|评价(0)|浏览(237)

本文整理了Java中org.apache.hadoop.hbase.Cell.heapSize()方法的一些代码示例,展示了Cell.heapSize()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Cell.heapSize()方法的具体详情如下:
包路径:org.apache.hadoop.hbase.Cell
类名称:Cell
方法名:heapSize

Cell.heapSize介绍

暂无

代码示例

代码示例来源:origin: apache/hbase

@Override
public long heapSize() {
 return cell.heapSize();
}

代码示例来源:origin: apache/hbase

@Override
public long heapSize() {
 long ret = ClassSize.ARRAYLIST;
 for (Cell cell : cells) {
  ret += cell.heapSize();
 }
 return ret;
}

代码示例来源:origin: apache/hbase

@Override
 public long heapSize() {
  return cell.heapSize();
 }
}

代码示例来源:origin: apache/hbase

/**
 * This is an estimate of the heap space occupied by a cell. When the cell is of type
 * {@link HeapSize} we call {@link HeapSize#heapSize()} so cell can give a correct value. In other
 * cases we just consider the bytes occupied by the cell components ie. row, CF, qualifier,
 * timestamp, type, value and tags.
 * @param cell
 * @return estimate of the heap space
 * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0.
 */
@Deprecated
public static long estimatedHeapSizeOf(final Cell cell) {
 return cell.heapSize();
}

代码示例来源:origin: apache/hbase

@Override
public long heapSize() {
 long sum = HEAP_SIZE_OVERHEAD + cell.heapSize();
 if (this.tags != null) {
  sum += ClassSize.sizeOf(this.tags);
 }
 return sum;
}

代码示例来源:origin: apache/hbase

static long calcEstimatedSize(Result rs) {
 long estimatedHeapSizeOfResult = 0;
 // We don't make Iterator here
 for (Cell cell : rs.rawCells()) {
  estimatedHeapSizeOfResult += cell.heapSize();
 }
 return estimatedHeapSizeOfResult;
}

代码示例来源:origin: apache/hbase

/**
 * Get total size of raw cells
 * @param result
 * @return Total size.
 */
public static long getTotalSizeOfCells(Result result) {
 long size = 0;
 if (result.isEmpty()) {
  return size;
 }
 for (Cell c : result.rawCells()) {
  size += c.heapSize();
 }
 return size;
}

代码示例来源:origin: apache/hbase

@Override
protected long calculateHeapSizeForBlockKeys(long heapSize) {
 if (blockKeys != null) {
  heapSize += ClassSize.REFERENCE;
  // Adding array + references overhead
  heapSize += ClassSize.align(ClassSize.ARRAY + blockKeys.length * ClassSize.REFERENCE);
  // Adding blockKeys
  for (Cell key : blockKeys) {
   heapSize += ClassSize.align(key.heapSize());
  }
 }
 // Add comparator and the midkey atomicreference
 heapSize += 2 * ClassSize.REFERENCE;
 return heapSize;
}

代码示例来源:origin: apache/hbase

actions.add(op);
op.put("total_size_sum", cell.heapSize());

代码示例来源:origin: apache/hbase

/**
 * @return Calculate what Mutation adds to class heap size.
 */
@Override
public long heapSize() {
 long heapsize = MUTATION_OVERHEAD;
 // Adding row
 heapsize += ClassSize.align(ClassSize.ARRAY + this.row.length);
 // Adding map overhead
 heapsize +=
  ClassSize.align(this.familyMap.size() * ClassSize.MAP_ENTRY);
 for(Map.Entry<byte [], List<Cell>> entry : this.familyMap.entrySet()) {
  //Adding key overhead
  heapsize +=
   ClassSize.align(ClassSize.ARRAY + entry.getKey().length);
  //This part is kinds tricky since the JVM can reuse references if you
  //store the same value, but have a good match with SizeOf at the moment
  //Adding value overhead
  heapsize += ClassSize.align(ClassSize.ARRAYLIST);
  int size = entry.getValue().size();
  heapsize += ClassSize.align(ClassSize.ARRAY +
    size * ClassSize.REFERENCE);
  for (Cell cell : entry.getValue()) {
   heapsize += cell.heapSize();
  }
 }
 heapsize += getAttributeSize();
 heapsize += extraHeapSize();
 return ClassSize.align(heapsize);
}

代码示例来源:origin: apache/hbase

protected long offHeapSizeChange(Cell cell, boolean allocated) {
 long res = 0;
 if (allocated) {
  boolean offHeap = false;
  MemStoreLAB memStoreLAB = getMemStoreLAB();
  if(memStoreLAB != null) {
   offHeap = memStoreLAB.isOffHeap();
  }
  res += indexEntryOffHeapSize(offHeap);
  if(offHeap) {
   res += cell.heapSize();
  }
  res = ClassSize.align(res);
 }
 return res;
}

代码示例来源:origin: apache/hbase

/**
 * @return The increase in heap size because of this cell addition. This includes this cell POJO's
 *         heap size itself and additional overhead because of addition on to CSLM.
 */
protected long heapSizeChange(Cell cell, boolean allocated) {
 long res = 0;
 if (allocated) {
  boolean onHeap = true;
  MemStoreLAB memStoreLAB = getMemStoreLAB();
  if(memStoreLAB != null) {
   onHeap = memStoreLAB.isOnHeap();
  }
  res += indexEntryOnHeapSize(onHeap);
  if(onHeap) {
   res += cell.heapSize();
  }
  res = ClassSize.align(res);
 }
 return res;
}

代码示例来源:origin: apache/hbase

/**
 * @return The approximate heap size of a cell in the test table. All cells should have
 *         approximately the same heap size, so the value is cached to avoid repeating the
 *         calculation
 * @throws Exception
 */
private long getCellHeapSize() throws Exception {
 if (CELL_HEAP_SIZE == -1) {
  // Do a partial scan that will return a single result with a single cell
  Scan scan = new Scan();
  scan.setMaxResultSize(2);
  scan.setAllowPartialResults(true);
  ResultScanner scanner = TABLE.getScanner(scan);
  Result result = scanner.next();
  assertTrue(result != null);
  assertTrue(result.rawCells() != null);
  assertTrue(result.rawCells().length == 1);
  // Estimate the cell heap size. One difference is that on server side, the KV Heap size is
  // estimated differently in case the cell is backed up by MSLAB byte[] (no overhead for
  // backing array). Thus below calculation is a bit brittle.
  CELL_HEAP_SIZE = result.rawCells()[0].heapSize() - (ClassSize.ARRAY + 3);
  if (LOG.isInfoEnabled()) LOG.info("Cell heap size: " + CELL_HEAP_SIZE);
  scanner.close();
 }
 return CELL_HEAP_SIZE;
}

代码示例来源:origin: apache/hbase

/**
 * @return The approximate heap size of a cell in the test table. All cells should have
 *         approximately the same heap size, so the value is cached to avoid repeating the
 *         calculation
 * @throws Exception
 */
private long getCellHeapSize() throws Exception {
 if (CELL_HEAP_SIZE == -1) {
  // Do a partial scan that will return a single result with a single cell
  Scan scan = new Scan();
  scan.setMaxResultSize(1);
  scan.setAllowPartialResults(true);
  ResultScanner scanner = TABLE.getScanner(scan);
  Result result = scanner.next();
  assertTrue(result != null);
  assertTrue(result.rawCells() != null);
  assertTrue(result.rawCells().length == 1);
  CELL_HEAP_SIZE = result.rawCells()[0].heapSize();
  scanner.close();
 }
 return CELL_HEAP_SIZE;
}

代码示例来源:origin: apache/hbase

for (Cell cell : results) {
 scannerContext.incrementSizeProgress(PrivateCellUtil.estimatedSerializedSizeOf(cell),
  cell.heapSize());

代码示例来源:origin: apache/hbase

scannerContext.incrementSizeProgress(cellSize, cell.heapSize());
scannerContext.incrementBatchProgress(1);

相关文章