Java Code Examples for org.apache.hadoop.hbase.Cell#heapSize()

The following examples show how to use org.apache.hadoop.hbase.Cell#heapSize() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Segment.java    From hbase with Apache License 2.0 6 votes vote down vote up
/**
 * @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;
}
 
Example 2
Source File: Segment.java    From hbase with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example 3
Source File: WALEdit.java    From hbase with Apache License 2.0 5 votes vote down vote up
@Override
public long heapSize() {
  long ret = ClassSize.ARRAYLIST;
  for (Cell cell : cells) {
    ret += cell.heapSize();
  }
  return ret;
}
 
Example 4
Source File: ConnectionUtils.java    From hbase with Apache License 2.0 5 votes vote down vote up
static long calcEstimatedSize(Result rs) {
  long estimatedHeapSizeOfResult = 0;
  // We don't make Iterator here
  for (Cell cell : rs.rawCells()) {
    estimatedHeapSizeOfResult += cell.heapSize();
  }
  return estimatedHeapSizeOfResult;
}
 
Example 5
Source File: Result.java    From hbase with Apache License 2.0 5 votes vote down vote up
/**
 * 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;
}