hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anoopsamj...@apache.org
Subject hbase git commit: HBASE-17071 Do not initialize MemstoreChunkPool when use mslab option is turned off.
Date Fri, 11 Nov 2016 11:14:55 GMT
Repository: hbase
Updated Branches:
  refs/heads/master f9c6b66b9 -> fa838b020


HBASE-17071 Do not initialize MemstoreChunkPool when use mslab option is turned off.


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/fa838b02
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/fa838b02
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/fa838b02

Branch: refs/heads/master
Commit: fa838b020df0235e9bea448730b3bd034e9bfb65
Parents: f9c6b66
Author: anoopsamjohn <anoopsamjohn@gmail.com>
Authored: Fri Nov 11 16:44:34 2016 +0530
Committer: anoopsamjohn <anoopsamjohn@gmail.com>
Committed: Fri Nov 11 16:44:34 2016 +0530

----------------------------------------------------------------------
 .../org/apache/hadoop/hbase/regionserver/MemStoreChunkPool.java | 5 +++++
 .../java/org/apache/hadoop/hbase/regionserver/MemStoreLAB.java  | 4 ++++
 .../org/apache/hadoop/hbase/regionserver/SegmentFactory.java    | 4 +---
 .../org/apache/hadoop/hbase/regionserver/TestCellFlatSet.java   | 2 +-
 .../hadoop/hbase/regionserver/TestCompactingMemStore.java       | 2 +-
 .../apache/hadoop/hbase/regionserver/TestMemStoreChunkPool.java | 2 +-
 6 files changed, 13 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/fa838b02/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MemStoreChunkPool.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MemStoreChunkPool.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MemStoreChunkPool.java
index 582eeba..db2cd18 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MemStoreChunkPool.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MemStoreChunkPool.java
@@ -202,6 +202,11 @@ public class MemStoreChunkPool implements HeapMemoryTuneObserver {
     synchronized (MemStoreChunkPool.class) {
       if (chunkPoolDisabled) return null;
       if (GLOBAL_INSTANCE != null) return GLOBAL_INSTANCE;
+      // When MSLAB is turned OFF no need to init chunk pool at all.
+      if (!conf.getBoolean(MemStoreLAB.USEMSLAB_KEY, MemStoreLAB.USEMSLAB_DEFAULT)) {
+        chunkPoolDisabled = true;
+        return null;
+      }
       float poolSizePercentage = conf.getFloat(CHUNK_POOL_MAXSIZE_KEY, POOL_MAX_SIZE_DEFAULT);
       if (poolSizePercentage <= 0) {
         chunkPoolDisabled = true;

http://git-wip-us.apache.org/repos/asf/hbase/blob/fa838b02/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MemStoreLAB.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MemStoreLAB.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MemStoreLAB.java
index 0dcafe6..706e243 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MemStoreLAB.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MemStoreLAB.java
@@ -44,6 +44,9 @@ import org.apache.hadoop.hbase.classification.InterfaceAudience;
 @InterfaceAudience.Private
 public interface MemStoreLAB {
 
+  String USEMSLAB_KEY = "hbase.hregion.memstore.mslab.enabled";
+  boolean USEMSLAB_DEFAULT = true;
+
   /**
    * Allocates slice in this LAB and copy the passed Cell into this area. Returns new Cell
instance
    * over the copied the data. When this MemStoreLAB can not copy this Cell, it returns null.
@@ -64,4 +67,5 @@ public interface MemStoreLAB {
    * Called when closing a scanner on the data of this MemStoreLAB
    */
   void decScannerCount();
+
 }

http://git-wip-us.apache.org/repos/asf/hbase/blob/fa838b02/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/SegmentFactory.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/SegmentFactory.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/SegmentFactory.java
index 4f60976..fa8860a 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/SegmentFactory.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/SegmentFactory.java
@@ -35,8 +35,6 @@ import java.util.List;
 @InterfaceAudience.Private
 public final class SegmentFactory {
 
-  static final String USEMSLAB_KEY = "hbase.hregion.memstore.mslab.enabled";
-  static final boolean USEMSLAB_DEFAULT = true;
   static final String MSLAB_CLASS_NAME = "hbase.regionserver.mslab.class";
 
   private SegmentFactory() {}
@@ -107,7 +105,7 @@ public final class SegmentFactory {
 
   private MemStoreLAB getMemStoreLAB(Configuration conf) {
     MemStoreLAB memStoreLAB = null;
-    if (conf.getBoolean(USEMSLAB_KEY, USEMSLAB_DEFAULT)) {
+    if (conf.getBoolean(MemStoreLAB.USEMSLAB_KEY, MemStoreLAB.USEMSLAB_DEFAULT)) {
       String className = conf.get(MSLAB_CLASS_NAME, HeapMemStoreLAB.class.getName());
       memStoreLAB = ReflectionUtils.instantiateWithCustomCtor(className,
           new Class[] { Configuration.class }, new Object[] { conf });

http://git-wip-us.apache.org/repos/asf/hbase/blob/fa838b02/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestCellFlatSet.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestCellFlatSet.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestCellFlatSet.java
index 2905a5b..62506ad 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestCellFlatSet.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestCellFlatSet.java
@@ -72,7 +72,7 @@ public class TestCellFlatSet extends TestCase {
     ascCbOnHeap = new CellArrayMap(CellComparator.COMPARATOR,ascCells,0,NUM_OF_CELLS,false);
     descCells = new Cell[] {kv4,kv3,kv2,kv1};
     descCbOnHeap = new CellArrayMap(CellComparator.COMPARATOR,descCells,0,NUM_OF_CELLS,true);
-    CONF.setBoolean(SegmentFactory.USEMSLAB_KEY, true);
+    CONF.setBoolean(MemStoreLAB.USEMSLAB_KEY, true);
     CONF.setFloat(MemStoreChunkPool.CHUNK_POOL_MAXSIZE_KEY, 0.2f);
     MemStoreChunkPool.chunkPoolDisabled = false;
     mslab = new HeapMemStoreLAB(CONF);

http://git-wip-us.apache.org/repos/asf/hbase/blob/fa838b02/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestCompactingMemStore.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestCompactingMemStore.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestCompactingMemStore.java
index 7dd9479..4f2b12f 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestCompactingMemStore.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestCompactingMemStore.java
@@ -86,7 +86,7 @@ public class TestCompactingMemStore extends TestDefaultMemStore {
   protected void compactingSetUp() throws Exception {
     super.internalSetUp();
     Configuration conf = new Configuration();
-    conf.setBoolean(SegmentFactory.USEMSLAB_KEY, true);
+    conf.setBoolean(MemStoreLAB.USEMSLAB_KEY, true);
     conf.setFloat(MemStoreChunkPool.CHUNK_POOL_MAXSIZE_KEY, 0.2f);
     conf.setInt(HRegion.MEMSTORE_PERIODIC_FLUSH_INTERVAL, 1000);
     HBaseTestingUtility hbaseUtility = HBaseTestingUtility.createLocalHTU(conf);

http://git-wip-us.apache.org/repos/asf/hbase/blob/fa838b02/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestMemStoreChunkPool.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestMemStoreChunkPool.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestMemStoreChunkPool.java
index 1d7aab1..5779dbc 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestMemStoreChunkPool.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestMemStoreChunkPool.java
@@ -49,7 +49,7 @@ public class TestMemStoreChunkPool {
 
   @BeforeClass
   public static void setUpBeforeClass() throws Exception {
-    conf.setBoolean(SegmentFactory.USEMSLAB_KEY, true);
+    conf.setBoolean(MemStoreLAB.USEMSLAB_KEY, true);
     conf.setFloat(MemStoreChunkPool.CHUNK_POOL_MAXSIZE_KEY, 0.2f);
     chunkPoolDisabledBeforeTest = MemStoreChunkPool.chunkPoolDisabled;
     MemStoreChunkPool.chunkPoolDisabled = false;


Mime
View raw message