HBASE-3658 Alert when heap is over committed

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1085195 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2011-03-24 23:36:36 +00:00
parent cad0a1bb9c
commit 5f69f20011
3 changed files with 20 additions and 1 deletions

View File

@ -186,7 +186,6 @@ Release 0.90.2 - Unreleased
HBASE-3497 TableMapReduceUtil.initTableReducerJob broken due to setConf
method in TableOutputFormat
IMPROVEMENTS
HBASE-3542 MultiGet methods in Thrift
HBASE-3586 Improve the selection of regions to balance (Ted Yu via Andrew
@ -206,6 +205,7 @@ Release 0.90.2 - Unreleased
HBASE-3596 [replication] Wait a few seconds before transferring queues
HBASE-3600 Update our jruby to 1.6.0
HBASE-3640 [replication] Transferring queues shouldn't be done inline with RS startup
HBASE-3658 Alert when heap is over committed (Subbu M Iyer via Stack)
Release 0.90.1 - February 9th, 2011

View File

@ -70,11 +70,25 @@ public class HBaseConfiguration extends Configuration {
}
}
private static void checkForClusterFreeMemoryLimit(Configuration conf) {
float globalMemstoreLimit = conf.getFloat("hbase.regionserver.global.memstore.upperLimit", 0.4f);
float blockCacheUpperLimit = conf.getFloat("hfile.block.cache.size", 0.2f);
if (1.0f - (globalMemstoreLimit + blockCacheUpperLimit)
< 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.");
}
}
public static Configuration addHbaseResources(Configuration conf) {
conf.addResource("hbase-default.xml");
conf.addResource("hbase-site.xml");
checkDefaultsVersion(conf);
checkForClusterFreeMemoryLimit(conf);
return conf;
}

View File

@ -364,6 +364,11 @@ public final class HConstants {
public static final String HBASE_MASTER_LOGCLEANER_PLUGINS =
"hbase.master.logcleaner.plugins";
/*
* Minimum percentage of free heap necessary for a successful cluster startup.
*/
public static final float HBASE_CLUSTER_MINIMUM_MEMORY_THRESHOLD = 0.2f;
private HConstants() {
// Can't be instantiated with this ctor.
}