HBASE-13943 Get rid of KeyValue#heapSizeWithoutTags.

This commit is contained in:
anoopsjohn 2015-06-30 23:09:09 +05:30
parent 7e7fbdb84b
commit 42d5ef017d
7 changed files with 3 additions and 49 deletions

View File

@ -589,21 +589,6 @@ public final class CellUtil {
return estimatedSerializedSizeOf(cell);
}
/**
* This is a hack that should be removed once we don't care about matching
* up client- and server-side estimations of cell size. It needed to be
* backwards compatible with estimations done by older clients. We need to
* pretend that tags never exist and cells aren't serialized with tag
* length included. See HBASE-13262 and HBASE-13303
*/
@Deprecated
public static long estimatedHeapSizeOfWithoutTags(final Cell cell) {
if (cell instanceof KeyValue) {
return ((KeyValue)cell).heapSizeWithoutTags();
}
return getSumOfCellKeyElementLengths(cell) + cell.getValueLength();
}
/********************* tags *************************************/
/**
* Util method to iterate through the tags

View File

@ -2669,27 +2669,6 @@ public class KeyValue implements Cell, HeapSize, Cloneable, SettableSequenceId,
return ClassSize.align(sum);
}
/**
* This is a hack that should be removed once we don't care about matching
* up client- and server-side estimations of cell size. It needed to be
* backwards compatible with estimations done by older clients. We need to
* pretend that tags never exist and KeyValues aren't serialized with tag
* length included. See HBASE-13262 and HBASE-13303
*/
@Deprecated
public long heapSizeWithoutTags() {
int sum = 0;
sum += ClassSize.OBJECT;// the KeyValue object itself
sum += ClassSize.REFERENCE;// pointer to "bytes"
sum += ClassSize.align(ClassSize.ARRAY);// "bytes"
sum += KeyValue.KEYVALUE_INFRASTRUCTURE_SIZE;
sum += getKeyLength();
sum += getValueLength();
sum += 2 * Bytes.SIZEOF_INT;// offset, length
sum += Bytes.SIZEOF_LONG;// memstoreTS
return ClassSize.align(sum);
}
/**
* A simple form of KeyValue that creates a keyvalue with only the key part of the byte[]
* Mainly used in places where we need to compare two cells. Avoids copying of bytes

View File

@ -59,9 +59,4 @@ public class SizeCachedKeyValue extends KeyValue {
public long heapSize() {
return super.heapSize() + HEAP_SIZE_OVERHEAD;
}
@Override
public long heapSizeWithoutTags() {
return super.heapSizeWithoutTags() + HEAP_SIZE_OVERHEAD;
}
}

View File

@ -42,11 +42,6 @@ public class SizeCachedNoTagsKeyValue extends SizeCachedKeyValue {
return 0;
}
@Override
public long heapSizeWithoutTags() {
return super.heapSize();
}
@Override
public int write(OutputStream out, boolean withTags) throws IOException {
writeInt(out, this.length);

View File

@ -5627,7 +5627,7 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
scannerContext.setTimeProgress(timeProgress);
scannerContext.incrementBatchProgress(results.size());
for (Cell cell : results) {
scannerContext.incrementSizeProgress(CellUtil.estimatedHeapSizeOfWithoutTags(cell));
scannerContext.incrementSizeProgress(CellUtil.estimatedHeapSizeOf(cell));
}
}

View File

@ -2336,7 +2336,7 @@ public class RSRpcServices implements HBaseRPCErrorHandler,
for (Result r : results) {
for (Cell cell : r.rawCells()) {
totalCellSize += CellUtil.estimatedSerializedSizeOf(cell);
currentScanResultSize += CellUtil.estimatedHeapSizeOfWithoutTags(cell);
currentScanResultSize += CellUtil.estimatedHeapSizeOf(cell);
}
}
}

View File

@ -590,7 +590,7 @@ public class StoreScanner extends NonReversedNonLazyKeyValueScanner
totalBytesRead += CellUtil.estimatedSerializedSizeOf(cell);
// Update the progress of the scanner context
scannerContext.incrementSizeProgress(CellUtil.estimatedHeapSizeOfWithoutTags(cell));
scannerContext.incrementSizeProgress(CellUtil.estimatedHeapSizeOf(cell));
scannerContext.incrementBatchProgress(1);
if (totalBytesRead > maxRowSize) {