You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by jg...@apache.org on 2011/10/21 23:28:16 UTC

svn commit: r1187552 - in /hbase/branches/0.92: CHANGES.txt src/main/java/org/apache/hadoop/hbase/HBaseConfiguration.java

Author: jgray
Date: Fri Oct 21 21:28:15 2011
New Revision: 1187552

URL: http://svn.apache.org/viewvc?rev=1187552&view=rev
Log:
HBASE-4588  The floating point arithmetic to validate memory allocation configurations need to be done as integers (dhruba)

Modified:
    hbase/branches/0.92/CHANGES.txt
    hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/HBaseConfiguration.java

Modified: hbase/branches/0.92/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/branches/0.92/CHANGES.txt?rev=1187552&r1=1187551&r2=1187552&view=diff
==============================================================================
--- hbase/branches/0.92/CHANGES.txt (original)
+++ hbase/branches/0.92/CHANGES.txt Fri Oct 21 21:28:15 2011
@@ -358,6 +358,8 @@ Release 0.92.0 - Unreleased
    HBASE-4595  HFilePrettyPrinter Scanned kv count always 0 (Matteo Bertozzi)
    HBASE-4580  Some invalid zk nodes were created when a clean cluster restarts
                (Gaojinchao)
+   HBASE-4588  The floating point arithmetic to validate memory allocation
+               configurations need to be done as integers (dhruba)
 
   TESTS
    HBASE-4492  TestRollingRestart fails intermittently

Modified: hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/HBaseConfiguration.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/HBaseConfiguration.java?rev=1187552&r1=1187551&r2=1187552&view=diff
==============================================================================
--- hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/HBaseConfiguration.java (original)
+++ hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/HBaseConfiguration.java Fri Oct 21 21:28:15 2011
@@ -33,6 +33,9 @@ public class HBaseConfiguration extends 
 
   private static final Log LOG = LogFactory.getLog(HBaseConfiguration.class);
 
+  // a constant to convert a fraction to a percentage
+  private static final int CONVERT_TO_PERCENTAGE = 100;
+
   /**
    * Instantinating HBaseConfiguration() is deprecated. Please use
    * HBaseConfiguration#create() to construct a plain Configuration
@@ -70,14 +73,21 @@ public class HBaseConfiguration extends 
 
   private static void checkForClusterFreeMemoryLimit(Configuration conf) {
       float globalMemstoreLimit = conf.getFloat("hbase.regionserver.global.memstore.upperLimit", 0.4f);
+      int gml = (int)(globalMemstoreLimit * CONVERT_TO_PERCENTAGE);
       float blockCacheUpperLimit = conf.getFloat("hfile.block.cache.size", 0.2f);
-      if (1.0f - (globalMemstoreLimit + blockCacheUpperLimit)
-              < HConstants.HBASE_CLUSTER_MINIMUM_MEMORY_THRESHOLD) {
+      int bcul = (int)(blockCacheUpperLimit * CONVERT_TO_PERCENTAGE);
+      if (CONVERT_TO_PERCENTAGE - (gml + bcul)
+              < (int)(CONVERT_TO_PERCENTAGE * 
+                      HConstants.HBASE_CLUSTER_MINIMUM_MEMORY_THRESHOLD)) {
           throw new RuntimeException(
-        "Current heap configuration for MemStore and BlockCache exceeds the threshold required for " +
-                "successful cluster operation. The combined value cannot exceed 0.8. Please check " +
-                "the settings for hbase.regionserver.global.memstore.upperLimit and" +
-                " hfile.block.cache.size in your configuration.");
+            "Current heap configuration for MemStore and BlockCache exceeds " +
+            "the threshold required for successful cluster operation. " +
+            "The combined value cannot exceed 0.8. Please check " +
+            "the settings for hbase.regionserver.global.memstore.upperLimit and " +
+            "hfile.block.cache.size in your configuration. " +
+            "hbase.regionserver.global.memstore.upperLimit is " + 
+            globalMemstoreLimit +
+            " hfile.block.cache.size is " + blockCacheUpperLimit);
       }
   }