You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by nd...@apache.org on 2014/09/12 20:37:03 UTC
git commit: HBASE-11949 Setting hfile.block.cache.size=0 doesn't
actually disable blockcache
Repository: hbase
Updated Branches:
refs/heads/master 013daadd9 -> 9f780499b
HBASE-11949 Setting hfile.block.cache.size=0 doesn't actually disable blockcache
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/9f780499
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/9f780499
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/9f780499
Branch: refs/heads/master
Commit: 9f780499bcd549525e4f8a9b506eb1b436aac348
Parents: 013daad
Author: Nick Dimiduk <nd...@apache.org>
Authored: Thu Sep 11 14:35:25 2014 -0700
Committer: Nick Dimiduk <nd...@apache.org>
Committed: Fri Sep 12 10:56:29 2014 -0700
----------------------------------------------------------------------
.../main/java/org/apache/hadoop/hbase/io/hfile/CacheConfig.java | 3 +++
1 file changed, 3 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/9f780499/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/CacheConfig.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/CacheConfig.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/CacheConfig.java
index 3ffac52..02e7fec 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/CacheConfig.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/CacheConfig.java
@@ -465,6 +465,7 @@ public class CacheConfig {
*/
private static LruBlockCache getL1(final Configuration c, final MemoryUsage mu) {
long lruCacheSize = getLruCacheSize(c, mu);
+ if (lruCacheSize < 0) return null;
int blockSize = c.getInt(BLOCKCACHE_BLOCKSIZE_KEY, HConstants.DEFAULT_BLOCKSIZE);
LOG.info("Allocating LruBlockCache size=" +
StringUtils.byteDesc(lruCacheSize) + ", blockSize=" + StringUtils.byteDesc(blockSize));
@@ -530,6 +531,8 @@ public class CacheConfig {
if (blockCacheDisabled) return null;
MemoryUsage mu = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage();
LruBlockCache l1 = getL1(conf, mu);
+ // blockCacheDisabled is set as a side-effect of getL1(), so check it again after the call.
+ if (blockCacheDisabled) return null;
BucketCache l2 = getL2(conf, mu);
if (l2 == null) {
GLOBAL_BLOCK_CACHE_INSTANCE = l1;