HBASE-4588 The floating point arithmetic to validate memory allocation configurations need to be done as integers (dhruba)
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1187551 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
f9f3a148d9
commit
bd7ff8ece3
|
@ -388,6 +388,8 @@ Release 0.92.0 - Unreleased
|
||||||
HBASE-4595 HFilePrettyPrinter Scanned kv count always 0 (Matteo Bertozzi)
|
HBASE-4595 HFilePrettyPrinter Scanned kv count always 0 (Matteo Bertozzi)
|
||||||
HBASE-4580 Some invalid zk nodes were created when a clean cluster restarts
|
HBASE-4580 Some invalid zk nodes were created when a clean cluster restarts
|
||||||
(Gaojinchao)
|
(Gaojinchao)
|
||||||
|
HBASE-4588 The floating point arithmetic to validate memory allocation
|
||||||
|
configurations need to be done as integers (dhruba)
|
||||||
|
|
||||||
TESTS
|
TESTS
|
||||||
HBASE-4450 test for number of blocks read: to serve as baseline for expected
|
HBASE-4450 test for number of blocks read: to serve as baseline for expected
|
||||||
|
|
|
@ -33,6 +33,9 @@ public class HBaseConfiguration extends Configuration {
|
||||||
|
|
||||||
private static final Log LOG = LogFactory.getLog(HBaseConfiguration.class);
|
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
|
* Instantinating HBaseConfiguration() is deprecated. Please use
|
||||||
* HBaseConfiguration#create() to construct a plain Configuration
|
* HBaseConfiguration#create() to construct a plain Configuration
|
||||||
|
@ -70,14 +73,21 @@ public class HBaseConfiguration extends Configuration {
|
||||||
|
|
||||||
private static void checkForClusterFreeMemoryLimit(Configuration conf) {
|
private static void checkForClusterFreeMemoryLimit(Configuration conf) {
|
||||||
float globalMemstoreLimit = conf.getFloat("hbase.regionserver.global.memstore.upperLimit", 0.4f);
|
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);
|
float blockCacheUpperLimit = conf.getFloat("hfile.block.cache.size", 0.2f);
|
||||||
if (1.0f - (globalMemstoreLimit + blockCacheUpperLimit)
|
int bcul = (int)(blockCacheUpperLimit * CONVERT_TO_PERCENTAGE);
|
||||||
< HConstants.HBASE_CLUSTER_MINIMUM_MEMORY_THRESHOLD) {
|
if (CONVERT_TO_PERCENTAGE - (gml + bcul)
|
||||||
|
< (int)(CONVERT_TO_PERCENTAGE *
|
||||||
|
HConstants.HBASE_CLUSTER_MINIMUM_MEMORY_THRESHOLD)) {
|
||||||
throw new RuntimeException(
|
throw new RuntimeException(
|
||||||
"Current heap configuration for MemStore and BlockCache exceeds the threshold required for " +
|
"Current heap configuration for MemStore and BlockCache exceeds " +
|
||||||
"successful cluster operation. The combined value cannot exceed 0.8. Please check " +
|
"the threshold required for successful cluster operation. " +
|
||||||
"the settings for hbase.regionserver.global.memstore.upperLimit and" +
|
"The combined value cannot exceed 0.8. Please check " +
|
||||||
" hfile.block.cache.size in your configuration.");
|
"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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue