Index: src/main/java/org/apache/hadoop/hbase/HBaseConfiguration.java =================================================================== --- src/main/java/org/apache/hadoop/hbase/HBaseConfiguration.java (date 1299110957000) +++ src/main/java/org/apache/hadoop/hbase/HBaseConfiguration.java (revision ) @@ -70,11 +70,25 @@ } } + 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; } Index: src/main/java/org/apache/hadoop/hbase/HConstants.java =================================================================== --- src/main/java/org/apache/hadoop/hbase/HConstants.java (date 1299110957000) +++ src/main/java/org/apache/hadoop/hbase/HConstants.java (revision ) @@ -364,6 +364,11 @@ 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. }