[ 
https://issues.apache.org/jira/browse/HBASE-17896?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15962575#comment-15962575
 ] 

Yu Li commented on HBASE-17896:
-------------------------------

It seems to me we should also update the DEEP_OVERHEAD after HBASE-17081 splits 
{{size}} into {{dataSize}} and {{heapSize}}
{code}
   public final static long DEEP_OVERHEAD = FIXED_OVERHEAD + 
ClassSize.ATOMIC_REFERENCE
-      + ClassSize.CELL_SET + ClassSize.ATOMIC_LONG + 
ClassSize.TIMERANGE_TRACKER;
+      + ClassSize.CELL_SET + 2 * ClassSize.ATOMIC_LONG + 
ClassSize.TIMERANGE_TRACKER;
{code}

and relatively, we should update the test case in TestHeapSize
{noformat}
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/io/TestHeapSize.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/io/TestHeapSize.java
@@ -344,7 +344,7 @@ public class TestHeapSize  {
     cl = Segment.class;
     actual = Segment.DEEP_OVERHEAD;
     expected = ClassSize.estimateBase(cl, false);
-    expected += ClassSize.estimateBase(AtomicLong.class, false);
+    expected += 2 * ClassSize.estimateBase(AtomicLong.class, false);
     expected += ClassSize.estimateBase(AtomicReference.class, false);
     expected += ClassSize.estimateBase(CellSet.class, false);
     expected += ClassSize.estimateBase(TimeRangeTracker.class, false);
@@ -361,7 +361,7 @@ public class TestHeapSize  {
     cl = MutableSegment.class;
     actual = MutableSegment.DEEP_OVERHEAD;
     expected = ClassSize.estimateBase(cl, false);
-    expected += ClassSize.estimateBase(AtomicLong.class, false);
+    expected += 2 * ClassSize.estimateBase(AtomicLong.class, false);
     expected += ClassSize.estimateBase(AtomicReference.class, false);
     expected += ClassSize.estimateBase(CellSet.class, false);
     expected += ClassSize.estimateBase(TimeRangeTracker.class, false);
@@ -380,7 +380,7 @@ public class TestHeapSize  {
     cl = ImmutableSegment.class;
     actual = ImmutableSegment.DEEP_OVERHEAD_CSLM;
     expected = ClassSize.estimateBase(cl, false);
-    expected += ClassSize.estimateBase(AtomicLong.class, false);
+    expected += 2 * ClassSize.estimateBase(AtomicLong.class, false);
     expected += ClassSize.estimateBase(AtomicReference.class, false);
     expected += ClassSize.estimateBase(CellSet.class, false);
     expected += ClassSize.estimateBase(TimeRangeTracker.class, false);
@@ -398,7 +398,7 @@ public class TestHeapSize  {
     }
     actual = ImmutableSegment.DEEP_OVERHEAD_CAM;
     expected = ClassSize.estimateBase(cl, false);
-    expected += ClassSize.estimateBase(AtomicLong.class, false);
+    expected += 2 * ClassSize.estimateBase(AtomicLong.class, false);
     expected += ClassSize.estimateBase(AtomicReference.class, false);
     expected += ClassSize.estimateBase(CellSet.class, false);
     expected += ClassSize.estimateBase(TimeRangeTracker.class, false);
{noformat}

Actually it confuses me why we should check {{DEAP_OVERHEAD}} for memstore and 
segment while all others (HStore, HRegion, etc.) only check {{FIXED_OVERHEAD}}, 
could you explain here sir [~anoop.hbase]? Thanks.

And mind explain the below change [~chia7712]? Thanks.
{code}
-    assertEquals(ClassSize.OBJECT + 4, ClassSize.ARRAY);
+    if (ClassSize.useUnsafeLayout()) {
+      assertEquals(ClassSize.OBJECT + 4, ClassSize.ARRAY);
+    } else {
+      assertEquals(ClassSize.OBJECT + 8, ClassSize.ARRAY);
+    }
{code}

> The FIXED_OVERHEAD of Segment is incorrect
> ------------------------------------------
>
>                 Key: HBASE-17896
>                 URL: https://issues.apache.org/jira/browse/HBASE-17896
>             Project: HBase
>          Issue Type: Sub-task
>    Affects Versions: 2.0.0
>            Reporter: Chia-Ping Tsai
>            Assignee: Chia-Ping Tsai
>            Priority: Minor
>             Fix For: 2.0.0
>
>         Attachments: HBASE-17896.v0.patch
>
>
> {noformat}
> 5 * ClassSize.REFERENCE // cellSet, comparator, memStoreLAB, size, 
> timeRangeTracker
> {noformat}
> In fact, the Segment has 6 references.
> # cellSet
> # comparator
> # memStoreLAB
> # dataSize
> # heapSize
> # timeRangeTracker



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to