HBASE-17836 CellUtil#estimatedSerializedSizeOf is slow when input is ByteBufferCell
This commit is contained in:
parent
48b2502a5f
commit
1a701ce444
|
@ -1385,12 +1385,10 @@ public final class CellUtil {
|
|||
* @return Estimate of the <code>cell</code> size in bytes.
|
||||
*/
|
||||
public static int estimatedSerializedSizeOf(final Cell cell) {
|
||||
// If a KeyValue, we can give a good estimate of size.
|
||||
if (cell instanceof KeyValue) {
|
||||
return ((KeyValue)cell).getLength() + Bytes.SIZEOF_INT;
|
||||
if (cell instanceof ExtendedCell) {
|
||||
return ((ExtendedCell) cell).getSerializedSize(true) + Bytes.SIZEOF_INT;
|
||||
}
|
||||
// TODO: Should we add to Cell a sizeOf? Would it help? Does it make sense if Cell is
|
||||
// prefix encoded or compressed?
|
||||
|
||||
return getSumOfCellElementLengths(cell) +
|
||||
// Use the KeyValue's infrastructure size presuming that another implementation would have
|
||||
// same basic cost.
|
||||
|
|
|
@ -86,7 +86,7 @@ public class SplitLogTask {
|
|||
public ServerName getServerName() {
|
||||
return this.originServer;
|
||||
}
|
||||
|
||||
|
||||
public ZooKeeperProtos.SplitLogTask.RecoveryMode getMode() {
|
||||
return this.mode;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue