hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mberto...@apache.org
Subject [2/2] hbase git commit: HBASE-14469 Fix comment, validation and logging in HeapMemorySizeUtil.getGlobalMemStoreLowerMark
Date Fri, 25 Sep 2015 02:24:41 GMT
HBASE-14469 Fix comment, validation and logging in HeapMemorySizeUtil.getGlobalMemStoreLowerMark


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

Branch: refs/heads/branch-1
Commit: efc51bced6a9516f3900a393308efeef63943bf4
Parents: 68cb682
Author: Apekshit(Appy) Sharma <appy@cloudera.com>
Authored: Wed Sep 23 01:17:50 2015 -0700
Committer: Matteo Bertozzi <matteo.bertozzi@cloudera.com>
Committed: Thu Sep 24 19:15:33 2015 -0700

----------------------------------------------------------------------
 .../hbase/io/util/HeapMemorySizeUtil.java       | 25 +++++++++++++-------
 1 file changed, 16 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/efc51bce/hbase-common/src/main/java/org/apache/hadoop/hbase/io/util/HeapMemorySizeUtil.java
----------------------------------------------------------------------
diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/io/util/HeapMemorySizeUtil.java
b/hbase-common/src/main/java/org/apache/hadoop/hbase/io/util/HeapMemorySizeUtil.java
index 1381a21..f1c0750 100644
--- a/hbase-common/src/main/java/org/apache/hadoop/hbase/io/util/HeapMemorySizeUtil.java
+++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/io/util/HeapMemorySizeUtil.java
@@ -90,24 +90,31 @@ public class HeapMemorySizeUtil {
   }
 
   /**
-   * Retrieve configured size for global memstore lower water mark as percentage of total
heap.
-   * @param c
-   * @param globalMemStorePercent
+   * Retrieve configured size for global memstore lower water mark as fraction of global
memstore
+   * size.
    */
-  public static float getGlobalMemStoreLowerMark(final Configuration c, float globalMemStorePercent)
{
-    String lowMarkPercentStr = c.get(MEMSTORE_SIZE_LOWER_LIMIT_KEY);
+  public static float getGlobalMemStoreLowerMark(final Configuration conf, float globalMemStorePercent)
{
+    String lowMarkPercentStr = conf.get(MEMSTORE_SIZE_LOWER_LIMIT_KEY);
     if (lowMarkPercentStr != null) {
-      return Float.parseFloat(lowMarkPercentStr);
+      float lowMarkPercent = Float.parseFloat(lowMarkPercentStr);
+      if (lowMarkPercent > 1.0f) {
+        LOG.error("Bad configuration value for " + MEMSTORE_SIZE_LOWER_LIMIT_KEY + ": " +
+            lowMarkPercent + ". Using 1.0f instead.");
+        lowMarkPercent = 1.0f;
+      }
+      return lowMarkPercent;
     }
-    String lowerWaterMarkOldValStr = c.get(MEMSTORE_SIZE_LOWER_LIMIT_OLD_KEY);
+    String lowerWaterMarkOldValStr = conf.get(MEMSTORE_SIZE_LOWER_LIMIT_OLD_KEY);
     if (lowerWaterMarkOldValStr != null) {
       LOG.warn(MEMSTORE_SIZE_LOWER_LIMIT_OLD_KEY + " is deprecated. Instead use "
           + MEMSTORE_SIZE_LOWER_LIMIT_KEY);
       float lowerWaterMarkOldVal = Float.parseFloat(lowerWaterMarkOldValStr);
       if (lowerWaterMarkOldVal > globalMemStorePercent) {
         lowerWaterMarkOldVal = globalMemStorePercent;
-        LOG.info("Setting globalMemStoreLimitLowMark == globalMemStoreLimit " + "because
supplied "
-            + MEMSTORE_SIZE_LOWER_LIMIT_OLD_KEY + " was > " + MEMSTORE_SIZE_OLD_KEY);
+        LOG.error("Value of " + MEMSTORE_SIZE_LOWER_LIMIT_OLD_KEY + " (" + lowerWaterMarkOldVal
+            + ") is greater than global memstore limit (" + globalMemStorePercent + ") set
by "
+            + MEMSTORE_SIZE_KEY + "/" + MEMSTORE_SIZE_OLD_KEY + ". Setting memstore lower
limit "
+            + "to " + globalMemStorePercent);
       }
       return lowerWaterMarkOldVal / globalMemStorePercent;
     }


Mime
View raw message