Index: src/main/java/org/apache/hadoop/hbase/HConstants.java =================================================================== --- src/main/java/org/apache/hadoop/hbase/HConstants.java (revision 1213939) +++ src/main/java/org/apache/hadoop/hbase/HConstants.java (working copy) @@ -540,6 +540,14 @@ public static final String HBASE_REGION_SPLIT_POLICY_KEY = "hbase.regionserver.region.split.policy"; + /** + * Configuration key for the size of the block cache + */ + public static final String HFILE_BLOCK_CACHE_SIZE_KEY = + "hfile.block.cache.size"; + + public static final float HFILE_BLOCK_CACHE_SIZE_DEFAULT = 0.25f; + /* * Minimum percentage of free heap necessary for a successful cluster startup. */ Index: src/main/java/org/apache/hadoop/hbase/regionserver/StoreFile.java =================================================================== --- src/main/java/org/apache/hadoop/hbase/regionserver/StoreFile.java (revision 1213939) +++ src/main/java/org/apache/hadoop/hbase/regionserver/StoreFile.java (working copy) @@ -85,8 +85,6 @@ public class StoreFile { static final Log LOG = LogFactory.getLog(StoreFile.class.getName()); - static final String HFILE_BLOCK_CACHE_SIZE_KEY = "hfile.block.cache.size"; - public static enum BloomType { /** * Bloomfilters disabled Index: src/main/java/org/apache/hadoop/hbase/HBaseConfiguration.java =================================================================== --- src/main/java/org/apache/hadoop/hbase/HBaseConfiguration.java (revision 1213939) +++ src/main/java/org/apache/hadoop/hbase/HBaseConfiguration.java (working copy) @@ -74,7 +74,9 @@ 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); + float blockCacheUpperLimit = + conf.getFloat(HConstants.HFILE_BLOCK_CACHE_SIZE_KEY, + HConstants.HFILE_BLOCK_CACHE_SIZE_DEFAULT); int bcul = (int)(blockCacheUpperLimit * CONVERT_TO_PERCENTAGE); if (CONVERT_TO_PERCENTAGE - (gml + bcul) < (int)(CONVERT_TO_PERCENTAGE * Index: src/main/java/org/apache/hadoop/hbase/master/HMaster.java =================================================================== --- src/main/java/org/apache/hadoop/hbase/master/HMaster.java (revision 1213939) +++ src/main/java/org/apache/hadoop/hbase/master/HMaster.java (working copy) @@ -57,7 +57,6 @@ import org.apache.hadoop.hbase.executor.EventHandler; import org.apache.hadoop.hbase.executor.ExecutorService; import org.apache.hadoop.hbase.executor.ExecutorService.ExecutorType; -import org.apache.hadoop.hbase.io.hfile.CacheConfig; import org.apache.hadoop.hbase.ipc.HBaseRPC; import org.apache.hadoop.hbase.ipc.HBaseServer; import org.apache.hadoop.hbase.ipc.HMasterInterface; @@ -217,7 +216,7 @@ throws IOException, KeeperException, InterruptedException { this.conf = new Configuration(conf); // Disable the block cache on the master - this.conf.setFloat(CacheConfig.HFILE_BLOCK_CACHE_SIZE_KEY, 0.0f); + this.conf.setFloat(HConstants.HFILE_BLOCK_CACHE_SIZE_KEY, 0.0f); // Set how many times to retry talking to another server over HConnection. HConnectionManager.setServerSideHConnectionRetries(this.conf, LOG); // Server to handle client requests. Index: src/main/java/org/apache/hadoop/hbase/io/hfile/HFile.java =================================================================== --- src/main/java/org/apache/hadoop/hbase/io/hfile/HFile.java (revision 1213939) +++ src/main/java/org/apache/hadoop/hbase/io/hfile/HFile.java (working copy) @@ -38,6 +38,7 @@ import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.fs.PathFilter; +import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.KeyValue; import org.apache.hadoop.hbase.KeyValue.KeyComparator; import org.apache.hadoop.hbase.io.HbaseMapWritable; @@ -278,7 +279,7 @@ public static final WriterFactory getWriterFactoryNoCache(Configuration conf) { Configuration tempConf = new Configuration(conf); - tempConf.setFloat(CacheConfig.HFILE_BLOCK_CACHE_SIZE_KEY, 0.0f); + tempConf.setFloat(HConstants.HFILE_BLOCK_CACHE_SIZE_KEY, 0.0f); return HFile.getWriterFactory(conf, new CacheConfig(tempConf)); } Index: src/main/java/org/apache/hadoop/hbase/io/hfile/CacheConfig.java =================================================================== --- src/main/java/org/apache/hadoop/hbase/io/hfile/CacheConfig.java (revision 1213939) +++ src/main/java/org/apache/hadoop/hbase/io/hfile/CacheConfig.java (working copy) @@ -24,6 +24,7 @@ import org.apache.commons.logging.LogFactory; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.HColumnDescriptor; +import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.regionserver.StoreFile; import org.apache.hadoop.hbase.util.DirectMemoryUtils; import org.apache.hadoop.util.StringUtils; @@ -35,12 +36,6 @@ private static final Log LOG = LogFactory.getLog(CacheConfig.class.getName()); /** - * Configuration key for the size of the block cache, in bytes. - */ - public static final String HFILE_BLOCK_CACHE_SIZE_KEY = - "hfile.block.cache.size"; - - /** * Configuration key to cache data blocks on write. There are separate * switches for bloom blocks and non-root index blocks. */ @@ -312,13 +307,14 @@ if (globalBlockCache != null) return globalBlockCache; if (blockCacheDisabled) return null; - float cachePercentage = conf.getFloat(HFILE_BLOCK_CACHE_SIZE_KEY, 0.2f); + float cachePercentage = conf.getFloat(HConstants.HFILE_BLOCK_CACHE_SIZE_KEY, + HConstants.HFILE_BLOCK_CACHE_SIZE_DEFAULT); if (cachePercentage == 0L) { blockCacheDisabled = true; return null; } if (cachePercentage > 1.0) { - throw new IllegalArgumentException(HFILE_BLOCK_CACHE_SIZE_KEY + + throw new IllegalArgumentException(HConstants.HFILE_BLOCK_CACHE_SIZE_KEY + " must be between 0.0 and 1.0, not > 1.0"); } Index: src/main/resources/hbase-default.xml =================================================================== --- src/main/resources/hbase-default.xml (revision 1213939) +++ src/main/resources/hbase-default.xml (working copy) @@ -445,13 +445,13 @@ - hfile.block.cache.size - 0.2 - - Percentage of maximum heap (-Xmx setting) to allocate to block cache - used by HFile/StoreFile. Default of 0.2 means allocate 20%. - Set to 0 to disable. - + hfile.block.cache.size + 0.25 + + Percentage of maximum heap (-Xmx setting) to allocate to block cache + used by HFile/StoreFile. Default of 0.25 means allocate 25%. + Set to 0 to disable but it's not recommended. + hbase.hash.type