From cacdb89e0345d4d507ae0ae04628d871d636fbca Mon Sep 17 00:00:00 2001 From: Ashish Singhi Date: Fri, 31 Oct 2014 20:42:21 +0530 Subject: [PATCH] HBASE-10870 Deprecate and replace HCD methods that have a 'should' prefix with a 'is' instead Signed-off-by: stack --- .../hadoop/hbase/HColumnDescriptor.java | 70 +++++++++++++++++++ .../hadoop/hbase/io/hfile/CacheConfig.java | 12 ++-- .../hadoop/hbase/regionserver/HStore.java | 2 +- 3 files changed, 77 insertions(+), 7 deletions(-) diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/HColumnDescriptor.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/HColumnDescriptor.java index 2e560d7dee3..f61a13dfcd7 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/HColumnDescriptor.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/HColumnDescriptor.java @@ -726,7 +726,9 @@ public class HColumnDescriptor implements Comparable { /** * @return Whether KV tags should be compressed along with DataBlockEncoding. When no * DataBlockEncoding is been used, this is having no effect. + * @deprecated Use {@link #isCompressTags()} instead */ + @Deprecated public boolean shouldCompressTags() { String compressTagsStr = getValue(COMPRESS_TAGS); boolean compressTags = DEFAULT_COMPRESS_TAGS; @@ -736,6 +738,19 @@ public class HColumnDescriptor implements Comparable { return compressTags; } + /** + * @return Whether KV tags should be compressed along with DataBlockEncoding. When no + * DataBlockEncoding is been used, this is having no effect. + */ + public boolean isCompressTags() { + String compressTagsStr = getValue(COMPRESS_TAGS); + boolean compressTags = DEFAULT_COMPRESS_TAGS; + if (compressTagsStr != null) { + compressTags = Boolean.valueOf(compressTagsStr); + } + return compressTags; + } + /** * @return Compression type setting. */ @@ -886,11 +901,20 @@ public class HColumnDescriptor implements Comparable { /** * @return true if we should cache data blocks on write + * @deprecated Use {@link #isCacheDataOnWrite()} instead */ + @Deprecated public boolean shouldCacheDataOnWrite() { return setAndGetBoolean(CACHE_DATA_ON_WRITE, DEFAULT_CACHE_DATA_ON_WRITE); } + /** + * @return true if we should cache data blocks on write + */ + public boolean isCacheDataOnWrite() { + return setAndGetBoolean(CACHE_DATA_ON_WRITE, DEFAULT_CACHE_DATA_ON_WRITE); + } + /** * @param value true if we should cache data blocks on write * @return this (for chained invocation) @@ -902,11 +926,21 @@ public class HColumnDescriptor implements Comparable { /** * @return true if we should cache data blocks in the L1 cache (if block cache deploy * has more than one tier; e.g. we are using CombinedBlockCache). + * @deprecated Use {@link #isCacheDataInL1()} instead */ + @Deprecated public boolean shouldCacheDataInL1() { return setAndGetBoolean(CACHE_DATA_IN_L1, DEFAULT_CACHE_DATA_IN_L1); } + /** + * @return true if we should cache data blocks in the L1 cache (if block cache deploy has more + * than one tier; e.g. we are using CombinedBlockCache). + */ + public boolean isCacheDataInL1() { + return setAndGetBoolean(CACHE_DATA_IN_L1, DEFAULT_CACHE_DATA_IN_L1); + } + /** * @param value true if we should cache data blocks in the L1 cache (if block cache deploy * has more than one tier; e.g. we are using CombinedBlockCache). @@ -924,11 +958,20 @@ public class HColumnDescriptor implements Comparable { /** * @return true if we should cache index blocks on write + * @deprecated Use {@link #isCacheIndexesOnWrite()} instead */ + @Deprecated public boolean shouldCacheIndexesOnWrite() { return setAndGetBoolean(CACHE_INDEX_ON_WRITE, DEFAULT_CACHE_INDEX_ON_WRITE); } + /** + * @return true if we should cache index blocks on write + */ + public boolean isCacheIndexesOnWrite() { + return setAndGetBoolean(CACHE_INDEX_ON_WRITE, DEFAULT_CACHE_INDEX_ON_WRITE); + } + /** * @param value true if we should cache index blocks on write * @return this (for chained invocation) @@ -939,11 +982,20 @@ public class HColumnDescriptor implements Comparable { /** * @return true if we should cache bloomfilter blocks on write + * @deprecated Use {@link #isCacheBloomsOnWrite()} instead */ + @Deprecated public boolean shouldCacheBloomsOnWrite() { return setAndGetBoolean(CACHE_BLOOMS_ON_WRITE, DEFAULT_CACHE_BLOOMS_ON_WRITE); } + /** + * @return true if we should cache bloomfilter blocks on write + */ + public boolean isCacheBloomsOnWrite() { + return setAndGetBoolean(CACHE_BLOOMS_ON_WRITE, DEFAULT_CACHE_BLOOMS_ON_WRITE); + } + /** * @param value true if we should cache bloomfilter blocks on write * @return this (for chained invocation) @@ -955,11 +1007,20 @@ public class HColumnDescriptor implements Comparable { /** * @return true if we should evict cached blocks from the blockcache on * close + * @deprecated {@link #isEvictBlocksOnClose()} instead */ + @Deprecated public boolean shouldEvictBlocksOnClose() { return setAndGetBoolean(EVICT_BLOCKS_ON_CLOSE, DEFAULT_EVICT_BLOCKS_ON_CLOSE); } + /** + * @return true if we should evict cached blocks from the blockcache on close + */ + public boolean isEvictBlocksOnClose() { + return setAndGetBoolean(EVICT_BLOCKS_ON_CLOSE, DEFAULT_EVICT_BLOCKS_ON_CLOSE); + } + /** * @param value true if we should evict cached blocks from the blockcache on * close @@ -971,11 +1032,20 @@ public class HColumnDescriptor implements Comparable { /** * @return true if we should prefetch blocks into the blockcache on open + * @deprecated Use {@link #isPrefetchBlocksOnOpen()} instead */ + @Deprecated public boolean shouldPrefetchBlocksOnOpen() { return setAndGetBoolean(PREFETCH_BLOCKS_ON_OPEN, DEFAULT_PREFETCH_BLOCKS_ON_OPEN); } + /** + * @return true if we should prefetch blocks into the blockcache on open + */ + public boolean isPrefetchBlocksOnOpen() { + return setAndGetBoolean(PREFETCH_BLOCKS_ON_OPEN, DEFAULT_PREFETCH_BLOCKS_ON_OPEN); + } + /** * @param value true if we should prefetch blocks into the blockcache on open * @return this (for chained invocation) 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 acb1ef52548..f212f14f45c 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 @@ -189,18 +189,18 @@ public class CacheConfig { // For the following flags we enable them regardless of per-schema settings // if they are enabled in the global configuration. conf.getBoolean(CACHE_BLOCKS_ON_WRITE_KEY, - DEFAULT_CACHE_DATA_ON_WRITE) || family.shouldCacheDataOnWrite(), + DEFAULT_CACHE_DATA_ON_WRITE) || family.isCacheDataOnWrite(), conf.getBoolean(CACHE_INDEX_BLOCKS_ON_WRITE_KEY, - DEFAULT_CACHE_INDEXES_ON_WRITE) || family.shouldCacheIndexesOnWrite(), + DEFAULT_CACHE_INDEXES_ON_WRITE) || family.isCacheIndexesOnWrite(), conf.getBoolean(CACHE_BLOOM_BLOCKS_ON_WRITE_KEY, - DEFAULT_CACHE_BLOOMS_ON_WRITE) || family.shouldCacheBloomsOnWrite(), + DEFAULT_CACHE_BLOOMS_ON_WRITE) || family.isCacheBloomsOnWrite(), conf.getBoolean(EVICT_BLOCKS_ON_CLOSE_KEY, - DEFAULT_EVICT_ON_CLOSE) || family.shouldEvictBlocksOnClose(), + DEFAULT_EVICT_ON_CLOSE) || family.isEvictBlocksOnClose(), conf.getBoolean(CACHE_DATA_BLOCKS_COMPRESSED_KEY, DEFAULT_CACHE_DATA_COMPRESSED), conf.getBoolean(PREFETCH_BLOCKS_ON_OPEN_KEY, - DEFAULT_PREFETCH_ON_OPEN) || family.shouldPrefetchBlocksOnOpen(), + DEFAULT_PREFETCH_ON_OPEN) || family.isPrefetchBlocksOnOpen(), conf.getBoolean(HColumnDescriptor.CACHE_DATA_IN_L1, - HColumnDescriptor.DEFAULT_CACHE_DATA_IN_L1) || family.shouldCacheDataInL1() + HColumnDescriptor.DEFAULT_CACHE_DATA_IN_L1) || family.isCacheDataInL1() ); } diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java index faf2eb14527..8b41401b540 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java @@ -976,7 +976,7 @@ public class HStore implements Store { .withIncludesMvcc(includeMVCCReadpoint) .withIncludesTags(includesTag) .withCompression(compression) - .withCompressTags(family.shouldCompressTags()) + .withCompressTags(family.isCompressTags()) .withChecksumType(checksumType) .withBytesPerCheckSum(bytesPerChecksum) .withBlockSize(blocksize)