hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From li...@apache.org
Subject svn commit: r1591722 - /hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/io/TestHeapSize.java
Date Thu, 01 May 2014 18:18:22 GMT
Author: liyin
Date: Thu May  1 18:18:22 2014
New Revision: 1591722

URL: http://svn.apache.org/r1591722
Log:
[master] Remove most of TestHeapSize

Author: elliott

Summary: Most of TestHeapSize is useless.  I just left the parts that I thought were actually
used a lot in memory accounting.

Test Plan: mvn clean test -Dtest=TestHeapSize

Reviewers: adela

Reviewed By: adela

CC: hbase-eng@

Differential Revision: https://phabricator.fb.com/D1300578

Task ID: 4222728

Modified:
    hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/io/TestHeapSize.java

Modified: hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/io/TestHeapSize.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/io/TestHeapSize.java?rev=1591722&r1=1591721&r2=1591722&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/io/TestHeapSize.java (original)
+++ hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/io/TestHeapSize.java Thu
May  1 18:18:22 2014
@@ -20,192 +20,22 @@
 
 package org.apache.hadoop.hbase.io;
 
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.util.ArrayList;
-import java.util.TreeMap;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentSkipListMap;
-import java.util.concurrent.CopyOnWriteArrayList;
-import java.util.concurrent.CopyOnWriteArraySet;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.concurrent.atomic.AtomicLong;
-import java.util.concurrent.locks.ReentrantReadWriteLock;
-
 import junit.framework.TestCase;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.hbase.KeyValue;
 import org.apache.hadoop.hbase.client.Put;
 import org.apache.hadoop.hbase.io.hfile.BlockCacheKey;
 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.MemStore;
-import org.apache.hadoop.hbase.regionserver.Store;
-import org.apache.hadoop.hbase.regionserver.metrics.SchemaConfigured;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.hbase.util.ClassSize;
 
+import java.io.IOException;
+import java.nio.ByteBuffer;
+
 /**
  * Testing the sizing that HeapSize offers and compares to the size given by
  * ClassSize.
  */
 public class TestHeapSize extends TestCase {
-  static final Log LOG = LogFactory.getLog(TestHeapSize.class);
-  // List of classes implementing HeapSize
-  // BatchOperation, BatchUpdate, BlockIndex, Entry, Entry<K,V>, HStoreKey
-  // KeyValue, LruBlockCache, LruHashMap<K,V>, Put, HLogKey
-
-  /**
-   * Test our hard-coded sizing of native java objects
-   */
-  public void testNativeSizes() throws IOException {
-    Class<?> cl = null;
-    long expected = 0L;
-    long actual = 0L;
-
-    // ArrayList
-    cl = ArrayList.class;
-    expected = ClassSize.estimateBase(cl, false);
-    actual = ClassSize.ARRAYLIST;
-    if(expected != actual) {
-      ClassSize.estimateBase(cl, true);
-      assertEquals(expected, actual);
-    }
-
-    // ByteBuffer
-    cl = ByteBuffer.class;
-    expected = ClassSize.estimateBase(cl, false);
-    actual = ClassSize.BYTE_BUFFER;
-    if(expected != actual) {
-      ClassSize.estimateBase(cl, true);
-      assertEquals(expected, actual);
-    }
-
-    // Integer
-    cl = Integer.class;
-    expected = ClassSize.estimateBase(cl, false);
-    actual = ClassSize.INTEGER;
-    if(expected != actual) {
-      ClassSize.estimateBase(cl, true);
-      assertEquals(expected, actual);
-    }
-
-    // Map.Entry
-    // Interface is public, all others are not.  Hard to size via ClassSize
-//    cl = Map.Entry.class;
-//    expected = ClassSize.estimateBase(cl, false);
-//    actual = ClassSize.MAP_ENTRY;
-//    if(expected != actual) {
-//      ClassSize.estimateBase(cl, true);
-//      assertEquals(expected, actual);
-//    }
-
-    // Object
-    cl = Object.class;
-    expected = ClassSize.estimateBase(cl, false);
-    actual = ClassSize.OBJECT;
-    if(expected != actual) {
-      ClassSize.estimateBase(cl, true);
-      assertEquals(expected, actual);
-    }
-
-    // TreeMap
-    cl = TreeMap.class;
-    expected = ClassSize.estimateBase(cl, false);
-    actual = ClassSize.TREEMAP;
-    if(expected != actual) {
-      ClassSize.estimateBase(cl, true);
-      assertEquals(expected, actual);
-    }
-
-    // String
-    cl = String.class;
-    expected = ClassSize.estimateBase(cl, false);
-    actual = ClassSize.STRING;
-    if(expected != actual) {
-      ClassSize.estimateBase(cl, true);
-      assertEquals(expected, actual);
-    }
-
-    // ConcurrentHashMap
-    cl = ConcurrentHashMap.class;
-    expected = ClassSize.estimateBase(cl, false);
-    actual = ClassSize.CONCURRENT_HASHMAP;
-    if(expected != actual) {
-      ClassSize.estimateBase(cl, true);
-      assertEquals(expected, actual);
-    }
-
-    // ConcurrentSkipListMap
-    cl = ConcurrentSkipListMap.class;
-    expected = ClassSize.estimateBase(cl, false);
-    actual = ClassSize.CONCURRENT_SKIPLISTMAP;
-    if(expected != actual) {
-      ClassSize.estimateBase(cl, true);
-      assertEquals(expected, actual);
-    }
-
-    // ReentrantReadWriteLock
-    cl = ReentrantReadWriteLock.class;
-    expected = ClassSize.estimateBase(cl, false);
-    actual = ClassSize.REENTRANT_LOCK;
-    if(expected != actual) {
-      ClassSize.estimateBase(cl, true);
-      assertEquals(expected, actual);
-    }
-
-    // AtomicLong
-    cl = AtomicLong.class;
-    expected = ClassSize.estimateBase(cl, false);
-    actual = ClassSize.ATOMIC_LONG;
-    if(expected != actual) {
-      ClassSize.estimateBase(cl, true);
-      assertEquals(expected, actual);
-    }
-
-    // AtomicInteger
-    cl = AtomicInteger.class;
-    expected = ClassSize.estimateBase(cl, false);
-    actual = ClassSize.ATOMIC_INTEGER;
-    if(expected != actual) {
-      ClassSize.estimateBase(cl, true);
-      assertEquals(expected, actual);
-    }
-
-    // AtomicBoolean
-    cl = AtomicBoolean.class;
-    expected = ClassSize.estimateBase(cl, false);
-    actual = ClassSize.ATOMIC_BOOLEAN;
-    if(expected != actual) {
-      ClassSize.estimateBase(cl, true);
-      assertEquals(expected, actual);
-    }
-
-    // CopyOnWriteArraySet
-    cl = CopyOnWriteArraySet.class;
-    expected = ClassSize.estimateBase(cl, false);
-    actual = ClassSize.COPYONWRITE_ARRAYSET;
-    if(expected != actual) {
-      ClassSize.estimateBase(cl, true);
-      assertEquals(expected, actual);
-    }
-
-    // CopyOnWriteArrayList
-    cl = CopyOnWriteArrayList.class;
-    expected = ClassSize.estimateBase(cl, false);
-    actual = ClassSize.COPYONWRITE_ARRAYLIST;
-    if(expected != actual) {
-      ClassSize.estimateBase(cl, true);
-      assertEquals(expected, actual);
-    }
-
-
-  }
-
   /**
    * Testing the classes that implements HeapSize and are a part of 0.20.
    * Some are not tested here for example BlockIndex which is tested in
@@ -239,15 +69,6 @@ public class TestHeapSize extends TestCa
       assertEquals(expected, actual);
     }
 
-    //LruBlockCache Overhead
-    cl = LruBlockCache.class;
-    actual = LruBlockCache.CACHE_FIXED_OVERHEAD;
-    expected = ClassSize.estimateBase(cl, false);
-    if(expected != actual) {
-      ClassSize.estimateBase(cl, true);
-      assertEquals(expected, actual);
-    }
-
     // CachedBlock Fixed Overhead
     // We really need "deep" sizing but ClassSize does not do this.
     // Perhaps we should do all these more in this style....
@@ -263,61 +84,6 @@ public class TestHeapSize extends TestCa
       assertEquals(expected, actual);
     }
 
-    // MemStore Overhead
-    cl = MemStore.class;
-    actual = MemStore.FIXED_OVERHEAD;
-    expected = ClassSize.estimateBase(cl, false);
-    if(expected != actual) {
-      ClassSize.estimateBase(cl, true);
-      assertEquals(expected, actual);
-    }
-
-    // MemStore Deep Overhead
-    actual = MemStore.DEEP_OVERHEAD;
-    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);
-    if(expected != actual) {
-      ClassSize.estimateBase(cl, true);
-      ClassSize.estimateBase(ReentrantReadWriteLock.class, true);
-      ClassSize.estimateBase(AtomicLong.class, true);
-      ClassSize.estimateBase(ConcurrentSkipListMap.class, true);
-      ClassSize.estimateBase(CopyOnWriteArraySet.class, true);
-      ClassSize.estimateBase(CopyOnWriteArrayList.class, true);
-      assertEquals(expected, actual);
-    }
-
-    // SchemaConfigured
-    cl = SchemaConfigured.class;
-    actual = new SchemaConfigured(null, "myTable", "myCF").heapSize();
-    expected = ClassSize.estimateBase(cl, false);
-    if (expected != actual) {
-      ClassSize.estimateBase(cl, true);
-      assertEquals(expected, actual);
-    }
-
-    // Store Overhead
-    cl = Store.class;
-    actual = Store.FIXED_OVERHEAD;
-    expected = ClassSize.estimateBase(cl, false);
-    if(expected != actual) {
-      ClassSize.estimateBase(cl, true);
-      assertEquals(expected, actual);
-    }
-
-    // Region Overhead
-    cl = HRegion.class;
-    actual = HRegion.FIXED_OVERHEAD;
-    expected = ClassSize.estimateBase(cl, false);
-    if(expected != actual) {
-      ClassSize.estimateBase(cl, true);
-      assertEquals(expected, actual);
-    }
-
     // Block cache key overhead. Only tests fixed overhead as estimating heap
     // size of strings is hard.
     cl = BlockCacheKey.class;



Mime
View raw message