Skip to content

Commit

Permalink
HBASE-22610 [BucketCache] Rename hbase.offheapcache.minblocksize
Browse files Browse the repository at this point in the history
Co-authored-by: Reid Chan <reidchan@apache.org>
Signed-off-by: Reid Chan <reidchan@apache.org>
  • Loading branch information
murtazahassan123 and Reidddddd committed Jul 23, 2019
1 parent 28de85f commit 0d8f9b5
Showing 1 changed file with 21 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,8 @@ public class CacheConfig {
/**
* The target block size used by blockcache instances. Defaults to
* {@link HConstants#DEFAULT_BLOCKSIZE}.
* TODO: this config point is completely wrong, as it's used to determine the
* target block size of BlockCache instances. Rename.
*/
public static final String BLOCKCACHE_BLOCKSIZE_KEY = "hbase.offheapcache.minblocksize";
public static final String BLOCKCACHE_BLOCKSIZE_KEY = "hbase.blockcache.minblocksize";

private static final String EXTERNAL_BLOCKCACHE_KEY = "hbase.blockcache.use.external";
private static final boolean EXTERNAL_BLOCKCACHE_DEFAULT = false;
Expand All @@ -141,6 +139,21 @@ public class CacheConfig {
private static final String DROP_BEHIND_CACHE_COMPACTION_KEY="hbase.hfile.drop.behind.compaction";
private static final boolean DROP_BEHIND_CACHE_COMPACTION_DEFAULT = true;

/**
* @deprecated use {@link CacheConfig#BLOCKCACHE_BLOCKSIZE_KEY} instead.
*/
@Deprecated
static final String DEPRECATED_BLOCKCACHE_BLOCKSIZE_KEY = "hbase.offheapcache.minblocksize";

/**
* The config point hbase.offheapcache.minblocksize is completely wrong, which is replaced by
* {@link BlockCacheFactory#BLOCKCACHE_BLOCKSIZE_KEY}. Keep the old config key here for backward
* compatibility.
*/
static {
Configuration.addDeprecation(DEPRECATED_BLOCKCACHE_BLOCKSIZE_KEY, BLOCKCACHE_BLOCKSIZE_KEY);
}

/**
* Enum of all built in external block caches.
* This is used for config.
Expand Down Expand Up @@ -675,6 +688,11 @@ private static BlockCache getBucketCache(Configuration c) {
public static synchronized BlockCache instantiateBlockCache(Configuration conf) {
if (GLOBAL_BLOCK_CACHE_INSTANCE != null) return GLOBAL_BLOCK_CACHE_INSTANCE;
if (blockCacheDisabled) return null;
if (conf.get(DEPRECATED_BLOCKCACHE_BLOCKSIZE_KEY) != null) {
LOG.warn("The config key " + DEPRECATED_BLOCKCACHE_BLOCKSIZE_KEY +
" is deprecated now, instead please use " + BLOCKCACHE_BLOCKSIZE_KEY +". "
+ "In future release we will remove the deprecated config.");
}
LruBlockCache l1 = getL1(conf);
// blockCacheDisabled is set as a side-effect of getL1Internal(), so check it again after the call.
if (blockCacheDisabled) return null;
Expand Down

0 comments on commit 0d8f9b5

Please sign in to comment.