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
|
@InterfaceStability.Evolving
|
||||||
public abstract class Mutation extends OperationWithAttributes implements Row, CellScannable,
|
public abstract class Mutation extends OperationWithAttributes implements Row, CellScannable,
|
||||||
HeapSize {
|
HeapSize {
|
||||||
static final long MUTATION_OVERHEAD = ClassSize.align(
|
public static final long MUTATION_OVERHEAD = ClassSize.align(
|
||||||
// This
|
// This
|
||||||
ClassSize.OBJECT +
|
ClassSize.OBJECT +
|
||||||
// OperationWithAttributes map reference? I don't know what the other reference is and if I
|
// row + OperationWithAttributes.attributes
|
||||||
// remove it it breaks TestHeapSize so just leaving it.
|
|
||||||
2 * ClassSize.REFERENCE +
|
2 * ClassSize.REFERENCE +
|
||||||
// Timestamp
|
// Timestamp
|
||||||
1 * Bytes.SIZEOF_LONG +
|
1 * Bytes.SIZEOF_LONG +
|
||||||
|
|
|
@ -353,32 +353,22 @@ public class TestHeapSize {
|
||||||
assertEquals(expected, actual);
|
assertEquals(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
byte[] row = new byte[] { 0 };
|
||||||
cl = Put.class;
|
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);
|
expected = ClassSize.estimateBase(cl, false);
|
||||||
//The actual TreeMap is not included in the above calculation
|
//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) {
|
if (expected != actual) {
|
||||||
ClassSize.estimateBase(cl, true);
|
ClassSize.estimateBase(cl, true);
|
||||||
assertEquals(expected, actual);
|
assertEquals(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
cl = Delete.class;
|
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);
|
expected = ClassSize.estimateBase(cl, false);
|
||||||
//The actual TreeMap is not included in the above calculation
|
//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 = 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);
|
|
||||||
if (expected != actual) {
|
if (expected != actual) {
|
||||||
ClassSize.estimateBase(cl, true);
|
ClassSize.estimateBase(cl, true);
|
||||||
assertEquals(expected, actual);
|
assertEquals(expected, actual);
|
||||||
|
|
Loading…
Reference in New Issue