hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From li...@apache.org
Subject svn commit: r1508978 - in /hbase/branches/0.89-fb/src: main/java/org/apache/hadoop/hbase/ main/java/org/apache/hadoop/hbase/regionserver/ test/java/org/apache/hadoop/hbase/metrics/ test/java/org/apache/hadoop/hbase/regionserver/
Date Wed, 31 Jul 2013 18:18:19 GMT
Author: liyin
Date: Wed Jul 31 18:18:19 2013
New Revision: 1508978

URL: http://svn.apache.org/r1508978
Log:
[master] Fix the unit tests: TestHeapSize, TestMetricsMBeanBase and TestStoreFile

Author: liyintang

Summary: Fix the unit tests: TestHeapSize, TestMetricsMBeanBase and TestStoreFile

Test Plan: mvn test

Reviewers: manukranthk, aaiyer

Reviewed By: manukranthk

CC: hbase-eng@

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

Modified:
    hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/HConstants.java
    hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/regionserver/MemStore.java
    hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/metrics/TestMetricsMBeanBase.java
    hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/regionserver/TestMemStore.java
    hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/regionserver/TestStoreFile.java

Modified: hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/HConstants.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/HConstants.java?rev=1508978&r1=1508977&r2=1508978&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/HConstants.java (original)
+++ hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/HConstants.java Wed Jul 31
18:18:19 2013
@@ -817,6 +817,9 @@ public final class HConstants {
   public final static String MEMSTORE_RESEEK_LINEAR_SEARCH_LIMIT_KEY = "hbase.hregion.memstore.linear.search.limit";
   public final static int MEMSTORE_RESEEK_LINEAR_SEARCH_LIMIT_DEFAULT = 20;
 
+  public static final String USE_MSLAB_KEY = "hbase.hregion.memstore.mslab.enabled";
+  public static final boolean USE_MSLAB_DEFAULT = false;
+
   private HConstants() {
     // Can't be instantiated with this constructor.
   }

Modified: hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/regionserver/MemStore.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/regionserver/MemStore.java?rev=1508978&r1=1508977&r2=1508978&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/regionserver/MemStore.java
(original)
+++ hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/regionserver/MemStore.java
Wed Jul 31 18:18:19 2013
@@ -57,10 +57,6 @@ import org.apache.hadoop.hbase.util.Coll
 public class MemStore implements HeapSize {
   private static final Log LOG = LogFactory.getLog(MemStore.class);
 
-  static final String USE_MSLAB_KEY =
-      "hbase.hregion.memstore.mslab.enabled";
-  private static final boolean USE_MSLAB_DEFAULT = false;
-
   private Configuration conf;
 
   // MemStore.  Use a KeyValueSkipListSet rather than SkipListSet because of the
@@ -128,7 +124,7 @@ public class MemStore implements HeapSiz
 
     this.successfullyAllocatedKvBytes = new AtomicLong(0);
 
-    if (conf.getBoolean(USE_MSLAB_KEY, USE_MSLAB_DEFAULT)) {
+    if (conf.getBoolean(HConstants.USE_MSLAB_KEY, HConstants.USE_MSLAB_DEFAULT)) {
       this.chunkPool = MemStoreChunkPool.getPool(conf);
       this.allocator = new MemStoreLAB(conf, chunkPool);
     } else {
@@ -787,7 +783,7 @@ public class MemStore implements HeapSiz
   }
 
   public final static long FIXED_OVERHEAD = ClassSize.align(
-      ClassSize.OBJECT + (11 * ClassSize.REFERENCE));
+      ClassSize.OBJECT + (16 * ClassSize.REFERENCE));
 
   public final static long DEEP_OVERHEAD = ClassSize.align(FIXED_OVERHEAD +
       ClassSize.REENTRANT_LOCK + ClassSize.ATOMIC_LONG +

Modified: hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/metrics/TestMetricsMBeanBase.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/metrics/TestMetricsMBeanBase.java?rev=1508978&r1=1508977&r2=1508978&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/metrics/TestMetricsMBeanBase.java
(original)
+++ hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/metrics/TestMetricsMBeanBase.java
Wed Jul 31 18:18:19 2013
@@ -84,12 +84,13 @@ public class TestMetricsMBeanBase extend
     assertEquals( 50L, this.stats.getAttribute("varyRateMaxTime") );
     assertEquals( 30L, this.stats.getAttribute("varyRateAvgTime") );
     assertEquals( 2, this.stats.getAttribute("varyRateNumOps") );
+    assertEquals( 0, this.stats.getAttribute("varyRateNumOpsCurrent") );
   }
 
   public void testGetMBeanInfo() {
     MBeanInfo info = this.stats.getMBeanInfo();
     MBeanAttributeInfo[] attributes = info.getAttributes();
-    assertEquals( 6, attributes.length );
+    assertEquals( 7, attributes.length );
 
     Map<String,MBeanAttributeInfo> attributeByName =
         new HashMap<String,MBeanAttributeInfo>(attributes.length);
@@ -108,6 +109,8 @@ public class TestMetricsMBeanBase extend
         "varyRateAvgTime", "java.lang.Long", "test");
     assertAttribute( attributeByName.get("varyRateNumOps"),
         "varyRateNumOps", "java.lang.Integer", "test");
+    assertAttribute( attributeByName.get("varyRateNumOpsCurrent"),
+      "varyRateNumOpsCurrent", "java.lang.Integer", "test");
   }
 
   protected void assertAttribute(MBeanAttributeInfo attr, String name,

Modified: hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/regionserver/TestMemStore.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/regionserver/TestMemStore.java?rev=1508978&r1=1508977&r2=1508978&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/regionserver/TestMemStore.java
(original)
+++ hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/regionserver/TestMemStore.java
Wed Jul 31 18:18:19 2013
@@ -817,7 +817,7 @@ public class TestMemStore extends TestCa
    */
   public void testUpsertMSLAB() throws Exception {
     Configuration conf = HBaseConfiguration.create();
-    conf.setBoolean(MemStore.USE_MSLAB_KEY, true);
+    conf.setBoolean(HConstants.USE_MSLAB_KEY, true);
     memstore = new MemStore(conf, KeyValue.COMPARATOR);
 
     int ROW_SIZE = 2048;

Modified: hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/regionserver/TestStoreFile.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/regionserver/TestStoreFile.java?rev=1508978&r1=1508977&r2=1508978&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/regionserver/TestStoreFile.java
(original)
+++ hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/regionserver/TestStoreFile.java
Wed Jul 31 18:18:19 2013
@@ -74,6 +74,7 @@ public class TestStoreFile extends HBase
 
   @Override
   public void setUp() throws Exception {
+    super.setUp();
     startingMetrics = SchemaMetrics.getMetricsSnapshot();
     try {
       this.cluster = new MiniDFSCluster(this.conf, 2, true, (String[])null);
@@ -84,7 +85,6 @@ public class TestStoreFile extends HBase
     } catch (IOException e) {
       shutdownDfs(cluster);
     }
-    super.setUp();
   }
 
   @Override



Mime
View raw message