hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndimi...@apache.org
Subject git commit: HBASE-11949 Setting hfile.block.cache.size=0 doesn't actually disable blockcache
Date Fri, 12 Sep 2014 18:39:21 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1 e469466cf -> 7df1582e1


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/7df1582e
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/7df1582e
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/7df1582e

Branch: refs/heads/branch-1
Commit: 7df1582e1438535227c6b6d122056d57969b279d
Parents: e469466
Author: Nick Dimiduk <ndimiduk@apache.org>
Authored: Thu Sep 11 14:35:25 2014 -0700
Committer: Nick Dimiduk <ndimiduk@apache.org>
Committed: Fri Sep 12 11:37:12 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/7df1582e/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;


Mime
View raw message