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:27:12 UTC
svn commit: r1187551 - in /hbase/trunk: CHANGES.txt
src/main/java/org/apache/hadoop/hbase/HBaseConfiguration.java
Author: jgray
Date: Fri Oct 21 21:27:12 2011
New Revision: 1187551
URL: http://svn.apache.org/viewvc?rev=1187551&view=rev
Log:
HBASE-4588 The floating point arithmetic to validate memory allocation configurations need to be done as integers (dhruba)
Modified:
hbase/trunk/CHANGES.txt
hbase/trunk/src/main/java/org/apache/hadoop/hbase/HBaseConfiguration.java
Modified: hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/trunk/CHANGES.txt?rev=1187551&r1=1187550&r2=1187551&view=diff
==============================================================================
--- hbase/trunk/CHANGES.txt (original)
+++ hbase/trunk/CHANGES.txt Fri Oct 21 21:27:12 2011
@@ -388,6 +388,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-4450 test for number of blocks read: to serve as baseline for expected
Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/HBaseConfiguration.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/HBaseConfiguration.java?rev=1187551&r1=1187550&r2=1187551&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/HBaseConfiguration.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/HBaseConfiguration.java Fri Oct 21 21:27:12 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);
}
}