HBASE-22610 [BucketCache] Rename hbase.offheapcache.minblocksize

Signed-off-by: Reid Chan <reidchan@apache.org>
Co-authored-by: Reid Chan <reidchan@apache.org>
This commit is contained in:
syedmurtazahassan 2019-07-23 11:17:27 +08:00 committed by Reid Chan
parent 0e34dcbf4b
commit 06f5c43de3
1 changed files with 21 additions and 3 deletions

View File

@ -78,20 +78,38 @@ public final class BlockCacheFactory {
/** /**
* The target block size used by blockcache instances. Defaults to * The target block size used by blockcache instances. Defaults to
* {@link HConstants#DEFAULT_BLOCKSIZE}. * {@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 String EXTERNAL_BLOCKCACHE_KEY = "hbase.blockcache.use.external";
private static final boolean EXTERNAL_BLOCKCACHE_DEFAULT = false; private static final boolean EXTERNAL_BLOCKCACHE_DEFAULT = false;
private static final String EXTERNAL_BLOCKCACHE_CLASS_KEY = "hbase.blockcache.external.class"; private static final String EXTERNAL_BLOCKCACHE_CLASS_KEY = "hbase.blockcache.external.class";
/**
* @deprecated use {@link BlockCacheFactory#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);
}
private BlockCacheFactory() { private BlockCacheFactory() {
} }
public static BlockCache createBlockCache(Configuration conf) { public static BlockCache createBlockCache(Configuration conf) {
if (conf.get(DEPRECATED_BLOCKCACHE_BLOCKSIZE_KEY) != null) {
LOG.warn("The config key {} is deprecated now, instead please use {}. In future release "
+ "we will remove the deprecated config.", DEPRECATED_BLOCKCACHE_BLOCKSIZE_KEY,
BLOCKCACHE_BLOCKSIZE_KEY);
}
FirstLevelBlockCache l1Cache = createFirstLevelCache(conf); FirstLevelBlockCache l1Cache = createFirstLevelCache(conf);
if (l1Cache == null) { if (l1Cache == null) {
return null; return null;