hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anoopsamj...@apache.org
Subject svn commit: r1525572 - in /hbase/branches/0.94/src: main/java/org/apache/hadoop/hbase/regionserver/ main/java/org/apache/hadoop/hbase/util/ test/java/org/apache/hadoop/hbase/io/
Date Mon, 23 Sep 2013 12:56:28 GMT
Author: anoopsamjohn
Date: Mon Sep 23 12:56:28 2013
New Revision: 1525572

URL: http://svn.apache.org/r1525572
Log:
HBASE-9430 Memstore heapSize calculation - DEEP_OVERHEAD is incorrect

Modified:
    hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/regionserver/KeyValueSkipListSet.java
    hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/regionserver/MemStore.java
    hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/util/ClassSize.java
    hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/io/TestHeapSize.java

Modified: hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/regionserver/KeyValueSkipListSet.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/regionserver/KeyValueSkipListSet.java?rev=1525572&r1=1525571&r2=1525572&view=diff
==============================================================================
--- hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/regionserver/KeyValueSkipListSet.java
(original)
+++ hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/regionserver/KeyValueSkipListSet.java
Mon Sep 23 12:56:28 2013
@@ -43,7 +43,7 @@ import java.util.concurrent.ConcurrentSk
  * has same attributes as ConcurrentSkipListSet: e.g. tolerant of concurrent
  * get and set and won't throw ConcurrentModificationException when iterating.
  */
-class KeyValueSkipListSet implements NavigableSet<KeyValue> {
+public class KeyValueSkipListSet implements NavigableSet<KeyValue> {
   private final ConcurrentNavigableMap<KeyValue, KeyValue> delegatee;
 
   KeyValueSkipListSet(final KeyValue.KVComparator c) {

Modified: hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/regionserver/MemStore.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/regionserver/MemStore.java?rev=1525572&r1=1525571&r2=1525572&view=diff
==============================================================================
--- hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/regionserver/MemStore.java (original)
+++ hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/regionserver/MemStore.java Mon
Sep 23 12:56:28 2013
@@ -931,8 +931,8 @@ public class MemStore implements HeapSiz
 
   public final static long DEEP_OVERHEAD = ClassSize.align(FIXED_OVERHEAD +
       ClassSize.REENTRANT_LOCK + ClassSize.ATOMIC_LONG +
-      ClassSize.COPYONWRITE_ARRAYSET + ClassSize.COPYONWRITE_ARRAYLIST +
-      (2 * ClassSize.CONCURRENT_SKIPLISTMAP));
+      (2 * ClassSize.TIMERANGE_TRACKER) +
+      (2 * ClassSize.KEYVALUE_SKIPLIST_SET) + (2 * ClassSize.CONCURRENT_SKIPLISTMAP));
 
   /** Used for readability when we don't store memstore timestamp in HFile */
   public static final boolean NO_PERSISTENT_TS = false;

Modified: hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/util/ClassSize.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/util/ClassSize.java?rev=1525572&r1=1525571&r2=1525572&view=diff
==============================================================================
--- hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/util/ClassSize.java (original)
+++ hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/util/ClassSize.java Mon Sep
23 12:56:28 2013
@@ -99,6 +99,12 @@ public class ClassSize {
   /** Overhead for CopyOnWriteArrayList */
   public static final int COPYONWRITE_ARRAYLIST;
 
+  /** Overhead for TimeRangeTracker */
+  public static final int TIMERANGE_TRACKER;
+
+  /** Overhead for KeyValueSkipListSet */
+  public static final int KEYVALUE_SKIPLIST_SET;
+
   /* Are we running on jdk7? */
   private static final boolean JDK7;
   static {
@@ -175,6 +181,10 @@ public class ClassSize {
     COPYONWRITE_ARRAYSET = align(OBJECT + REFERENCE);
 
     COPYONWRITE_ARRAYLIST = align(OBJECT + (2 * REFERENCE) + ARRAY);
+
+    TIMERANGE_TRACKER = align(ClassSize.OBJECT + Bytes.SIZEOF_LONG * 2);
+
+    KEYVALUE_SKIPLIST_SET = align(OBJECT + REFERENCE);
   }
 
   /**

Modified: hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/io/TestHeapSize.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/io/TestHeapSize.java?rev=1525572&r1=1525571&r2=1525572&view=diff
==============================================================================
--- hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/io/TestHeapSize.java (original)
+++ hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/io/TestHeapSize.java Mon Sep
23 12:56:28 2013
@@ -44,8 +44,10 @@ import org.apache.hadoop.hbase.io.hfile.
 import org.apache.hadoop.hbase.io.hfile.CachedBlock;
 import org.apache.hadoop.hbase.io.hfile.LruBlockCache;
 import org.apache.hadoop.hbase.regionserver.HRegion;
+import org.apache.hadoop.hbase.regionserver.KeyValueSkipListSet;
 import org.apache.hadoop.hbase.regionserver.MemStore;
 import org.apache.hadoop.hbase.regionserver.Store;
+import org.apache.hadoop.hbase.regionserver.TimeRangeTracker;
 import org.apache.hadoop.hbase.regionserver.metrics.SchemaConfigured;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.hbase.util.ClassSize;
@@ -207,7 +209,23 @@ public class TestHeapSize extends TestCa
       assertEquals(expected, actual);
     }
 
+    // TimeRangeTracker
+    cl = TimeRangeTracker.class;
+    expected = ClassSize.estimateBase(cl, false);
+    actual = ClassSize.TIMERANGE_TRACKER;
+    if (expected != actual) {
+      ClassSize.estimateBase(cl, true);
+      assertEquals(expected, actual);
+    }
 
+    // KeyValueSkipListSet
+    cl = KeyValueSkipListSet.class;
+    expected = ClassSize.estimateBase(cl, false);
+    actual = ClassSize.KEYVALUE_SKIPLIST_SET;
+    if (expected != actual) {
+      ClassSize.estimateBase(cl, true);
+      assertEquals(expected, actual);
+    }
   }
 
   /**
@@ -282,17 +300,19 @@ public class TestHeapSize extends TestCa
     expected = ClassSize.estimateBase(cl, false);
     expected += ClassSize.estimateBase(ReentrantReadWriteLock.class, false);
     expected += ClassSize.estimateBase(AtomicLong.class, false);
-    expected += ClassSize.estimateBase(ConcurrentSkipListMap.class, false);
-    expected += ClassSize.estimateBase(ConcurrentSkipListMap.class, false);
-    expected += ClassSize.estimateBase(CopyOnWriteArraySet.class, false);
-    expected += ClassSize.estimateBase(CopyOnWriteArrayList.class, false);
+    expected += (2 * ClassSize.estimateBase(KeyValueSkipListSet.class, false));
+    expected += (2 * ClassSize.estimateBase(ConcurrentSkipListMap.class, false));
+    expected += (2 * ClassSize.estimateBase(TimeRangeTracker.class, false));
     if(expected != actual) {
       ClassSize.estimateBase(cl, true);
       ClassSize.estimateBase(ReentrantReadWriteLock.class, true);
       ClassSize.estimateBase(AtomicLong.class, true);
+      ClassSize.estimateBase(KeyValueSkipListSet.class, true);
+      ClassSize.estimateBase(KeyValueSkipListSet.class, true);
+      ClassSize.estimateBase(ConcurrentSkipListMap.class, true);
       ClassSize.estimateBase(ConcurrentSkipListMap.class, true);
-      ClassSize.estimateBase(CopyOnWriteArraySet.class, true);
-      ClassSize.estimateBase(CopyOnWriteArrayList.class, true);
+      ClassSize.estimateBase(TimeRangeTracker.class, true);
+      ClassSize.estimateBase(TimeRangeTracker.class, true);
       assertEquals(expected, actual);
     }
 



Mime
View raw message