HBASE-8393 Testcase TestHeapSize#testMutations is wrong (Jeffrey)
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1476022 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
76bae3d62d
commit
1eadb508ab
|
@ -43,11 +43,10 @@ import java.util.UUID;
|
|||
@InterfaceStability.Evolving
|
||||
public abstract class Mutation extends OperationWithAttributes implements Row, CellScannable,
|
||||
HeapSize {
|
||||
static final long MUTATION_OVERHEAD = ClassSize.align(
|
||||
public static final long MUTATION_OVERHEAD = ClassSize.align(
|
||||
// This
|
||||
ClassSize.OBJECT +
|
||||
// OperationWithAttributes map reference? I don't know what the other reference is and if I
|
||||
// remove it it breaks TestHeapSize so just leaving it.
|
||||
// row + OperationWithAttributes.attributes
|
||||
2 * ClassSize.REFERENCE +
|
||||
// Timestamp
|
||||
1 * Bytes.SIZEOF_LONG +
|
||||
|
|
|
@ -353,32 +353,22 @@ public class TestHeapSize {
|
|||
assertEquals(expected, actual);
|
||||
}
|
||||
|
||||
byte[] row = new byte[] { 0 };
|
||||
cl = Put.class;
|
||||
actual = new Put(new byte[]{0}).heapSize();
|
||||
actual = new Put(row).MUTATION_OVERHEAD + ClassSize.align(ClassSize.ARRAY);
|
||||
expected = ClassSize.estimateBase(cl, false);
|
||||
//The actual TreeMap is not included in the above calculation
|
||||
expected += ClassSize.align(ClassSize.TREEMAP + ClassSize.REFERENCE);
|
||||
expected += ClassSize.align(ClassSize.TREEMAP);
|
||||
if (expected != actual) {
|
||||
ClassSize.estimateBase(cl, true);
|
||||
assertEquals(expected, actual);
|
||||
}
|
||||
|
||||
|
||||
cl = Delete.class;
|
||||
actual = new Delete(new byte[]{0}).heapSize();
|
||||
actual = new Delete(row).MUTATION_OVERHEAD + ClassSize.align(ClassSize.ARRAY);
|
||||
expected = ClassSize.estimateBase(cl, false);
|
||||
//The actual TreeMap is not included in the above calculation
|
||||
expected += ClassSize.align(ClassSize.TREEMAP + ClassSize.REFERENCE);
|
||||
if (expected != actual) {
|
||||
ClassSize.estimateBase(cl, true);
|
||||
assertEquals(expected, actual);
|
||||
}
|
||||
|
||||
cl = Increment.class;
|
||||
actual = new Increment(new byte[]{0}).heapSize();
|
||||
expected = ClassSize.estimateBase(cl, false);
|
||||
//The actual TreeMap and TimeRange are not included in the above calculation
|
||||
expected += ClassSize.align(ClassSize.TREEMAP + ClassSize.REFERENCE + ClassSize.TIMERANGE);
|
||||
expected += ClassSize.align(ClassSize.TREEMAP);
|
||||
if (expected != actual) {
|
||||
ClassSize.estimateBase(cl, true);
|
||||
assertEquals(expected, actual);
|
||||
|
|
Loading…
Reference in New Issue