本文整理了Java中org.apache.hadoop.hbase.Cell.getSerializedSize()
方法的一些代码示例,展示了Cell.getSerializedSize()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Cell.getSerializedSize()
方法的具体详情如下:
包路径:org.apache.hadoop.hbase.Cell
类名称:Cell
方法名:getSerializedSize
暂无
代码示例来源:origin: apache/hbase
/**
* Estimate based on keyvalue's serialization format in the RPC layer. Note that there is an extra
* SIZEOF_INT added to the size here that indicates the actual length of the cell for cases where
* cell's are serialized in a contiguous format (For eg in RPCs).
* @param cell
* @return Estimate of the <code>cell</code> size in bytes plus an extra SIZEOF_INT indicating the
* actual cell length.
*/
public static int estimatedSerializedSizeOf(final Cell cell) {
return cell.getSerializedSize() + Bytes.SIZEOF_INT;
}
代码示例来源:origin: apache/hbase
/**
* Get cell length after serialized in {@link KeyValue}
*/
@VisibleForTesting
static int getCellLength(Cell cell) {
return cell.getSerializedSize();
}
代码示例来源:origin: apache/hbase
public static long calculateMutationSize(final Mutation mutation) {
long size = 0;
for (Map.Entry<byte[], List<Cell>> entry : mutation.getFamilyCellMap().entrySet()) {
for (Cell cell : entry.getValue()) {
size += cell.getSerializedSize();
}
}
return size;
}
代码示例来源:origin: apache/hbase
public static long calculateResultSize(final Result result) {
long size = 0;
for (Cell cell : result.rawCells()) {
size += cell.getSerializedSize();
}
return size;
}
代码示例来源:origin: apache/hbase
public static byte[] copyToNewByteArray(final Cell cell) {
int v1Length = cell.getSerializedSize();
byte[] backingBytes = new byte[v1Length];
appendToByteArray(cell, backingBytes, 0, true);
return backingBytes;
}
代码示例来源:origin: apache/hbase
public static long calculateResultSize(final List<Result> results) {
long size = 0;
for (Result result: results) {
for (Cell cell : result.rawCells()) {
size += cell.getSerializedSize();
}
}
return size;
}
}
代码示例来源:origin: apache/hbase
public static void validatePut(Put put, int maxKeyValueSize) throws IllegalArgumentException {
if (put.isEmpty()) {
throw new IllegalArgumentException("No columns to insert");
}
if (maxKeyValueSize > 0) {
for (List<Cell> list : put.getFamilyCellMap().values()) {
for (Cell cell : list) {
if (cell.getSerializedSize() > maxKeyValueSize) {
throw new IllegalArgumentException("KeyValue size too large");
}
}
}
}
}
代码示例来源:origin: apache/hbase
/**
* Update LongAdders for number of puts without wal and the size of possible data loss.
* These information are exposed by the region server metrics.
*/
private void recordMutationWithoutWal(final Map<byte [], List<Cell>> familyMap) {
numMutationsWithoutWAL.increment();
if (numMutationsWithoutWAL.sum() <= 1) {
LOG.info("writing data to region " + this +
" with WAL disabled. Data may be lost in the event of a crash.");
}
long mutationSize = 0;
for (List<Cell> cells: familyMap.values()) {
// Optimization: 'foreach' loop is not used. See:
// HBASE-12023 HRegion.applyFamilyMapToMemstore creates too many iterator objects
assert cells instanceof RandomAccess;
int listSize = cells.size();
for (int i=0; i < listSize; i++) {
Cell cell = cells.get(i);
mutationSize += cell.getSerializedSize();
}
}
dataInMemoryWithoutWAL.add(mutationSize);
}
代码示例来源:origin: apache/hbase
public void collect(Cell cell) {
valLen.update(cell.getValueLength());
if (prevCell != null &&
CellComparator.getInstance().compareRows(prevCell, cell) != 0) {
// new row
collectRow();
}
curRowBytes += cell.getSerializedSize();
curRowKeyLength = KeyValueUtil.keyLength(cell);
curRowCols++;
prevCell = cell;
}
代码示例来源:origin: apache/hbase
public static int getSerializedSize(Cell cell, boolean withTags) {
if (withTags) {
return cell.getSerializedSize();
}
if (cell instanceof ExtendedCell) {
return ((ExtendedCell) cell).getSerializedSize(withTags);
}
return length(cell.getRowLength(), cell.getFamilyLength(), cell.getQualifierLength(),
cell.getValueLength(), cell.getTagsLength(), withTags);
}
代码示例来源:origin: apache/hbase
throughputController.control(flushName, c.getSerializedSize());
代码示例来源:origin: apache/hbase
final long originalSize = originalCell.getSerializedSize();
final long addSize = addCell.getSerializedSize();
代码示例来源:origin: apache/hbase
int len = c.getSerializedSize();
++progress.currentCompactedKVs;
progress.totalCompactedSize += len;
代码示例来源:origin: apache/hbase
throughputController.control(flushName, c.getSerializedSize());
代码示例来源:origin: apache/hbase
cellsSizeCompactedToMob += c.getValueLength();
int len = c.getSerializedSize();
++progress.currentCompactedKVs;
progress.totalCompactedSize += len;
代码示例来源:origin: apache/hbase
if (dataOffset + kv.getSerializedSize() > chunkCreator.getChunkSize()) {
idxOffset = ByteBufferUtils.putInt(idxBuffer, idxOffset, kv.getSerializedSize()); // length
代码示例来源:origin: apache/hbase
idxOffset = ByteBufferUtils.putInt(idxBuffer, idxOffset, kv.getSerializedSize()); // length
内容来源于网络,如有侵权,请联系作者删除!