Skip to content

Commit fe450b5

Browse files
murtazahassan123Reidddddd
authored andcommitted
HBASE-22610 [BucketCache] Rename hbase.offheapcache.minblocksize
* HBASE-22610 [BucketCache] Rename hbase.offheapcache.minblocksize. * HBASE-22610 [BucketCache] Rename hbase.offheapcache.minblocksize. Deprecated old attribute and introduced a new one * HBASE-22610 [BucketCache] Rename hbase.offheapcache.minblocksize. Removed unnecessary import * HBASE-22610 added two import configs and removed one Signed-off-by: Reid Chan <reidchan@apache.org>
1 parent 9615c64 commit fe450b5

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/BlockCacheFactory.java

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,20 +78,38 @@ public final class BlockCacheFactory {
7878
/**
7979
* The target block size used by blockcache instances. Defaults to
8080
* {@link HConstants#DEFAULT_BLOCKSIZE}.
81-
* TODO: this config point is completely wrong, as it's used to determine the
82-
* target block size of BlockCache instances. Rename.
8381
*/
84-
public static final String BLOCKCACHE_BLOCKSIZE_KEY = "hbase.offheapcache.minblocksize";
82+
public static final String BLOCKCACHE_BLOCKSIZE_KEY = "hbase.blockcache.minblocksize";
8583

8684
private static final String EXTERNAL_BLOCKCACHE_KEY = "hbase.blockcache.use.external";
8785
private static final boolean EXTERNAL_BLOCKCACHE_DEFAULT = false;
8886

8987
private static final String EXTERNAL_BLOCKCACHE_CLASS_KEY = "hbase.blockcache.external.class";
9088

89+
/**
90+
* @deprecated use {@link BlockCacheFactory#BLOCKCACHE_BLOCKSIZE_KEY} instead.
91+
*/
92+
@Deprecated
93+
static final String DEPRECATED_BLOCKCACHE_BLOCKSIZE_KEY = "hbase.blockcache.minblocksize";
94+
95+
/**
96+
* The config point hbase.offheapcache.minblocksize is completely wrong, which is replaced by
97+
* {@link BlockCacheFactory#BLOCKCACHE_BLOCKSIZE_KEY}. Keep the old config key here for backward
98+
* compatibility.
99+
*/
100+
static {
101+
Configuration.addDeprecation(DEPRECATED_BLOCKCACHE_BLOCKSIZE_KEY, BLOCKCACHE_BLOCKSIZE_KEY);
102+
}
103+
91104
private BlockCacheFactory() {
92105
}
93106

94107
public static BlockCache createBlockCache(Configuration conf) {
108+
if (conf.get(DEPRECATED_BLOCKCACHE_BLOCKSIZE_KEY) != null) {
109+
LOG.warn("The config key {} is deprecated now, instead please use {}. In future release "
110+
+ "we will remove the deprecated config.", DEPRECATED_BLOCKCACHE_BLOCKSIZE_KEY,
111+
BLOCKCACHE_BLOCKSIZE_KEY);
112+
}
95113
FirstLevelBlockCache l1Cache = createFirstLevelCache(conf);
96114
if (l1Cache == null) {
97115
return null;

0 commit comments

Comments
 (0)