HBASE-10870 Deprecate and replace HCD methods that have a 'should' prefix with a 'is' instead

Signed-off-by: stack <stack@apache.org>
This commit is contained in:
Ashish Singhi 2014-10-31 20:42:21 +05:30 committed by stack
parent ba7344f5d1
commit cacdb89e03
3 changed files with 77 additions and 7 deletions

View File

@ -726,7 +726,9 @@ public class HColumnDescriptor implements Comparable<HColumnDescriptor> {
/** /**
* @return Whether KV tags should be compressed along with DataBlockEncoding. When no * @return Whether KV tags should be compressed along with DataBlockEncoding. When no
* DataBlockEncoding is been used, this is having no effect. * DataBlockEncoding is been used, this is having no effect.
* @deprecated Use {@link #isCompressTags()} instead
*/ */
@Deprecated
public boolean shouldCompressTags() { public boolean shouldCompressTags() {
String compressTagsStr = getValue(COMPRESS_TAGS); String compressTagsStr = getValue(COMPRESS_TAGS);
boolean compressTags = DEFAULT_COMPRESS_TAGS; boolean compressTags = DEFAULT_COMPRESS_TAGS;
@ -736,6 +738,19 @@ public class HColumnDescriptor implements Comparable<HColumnDescriptor> {
return compressTags; 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. * @return Compression type setting.
*/ */
@ -886,11 +901,20 @@ public class HColumnDescriptor implements Comparable<HColumnDescriptor> {
/** /**
* @return true if we should cache data blocks on write * @return true if we should cache data blocks on write
* @deprecated Use {@link #isCacheDataOnWrite()} instead
*/ */
@Deprecated
public boolean shouldCacheDataOnWrite() { public boolean shouldCacheDataOnWrite() {
return setAndGetBoolean(CACHE_DATA_ON_WRITE, DEFAULT_CACHE_DATA_ON_WRITE); 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 * @param value true if we should cache data blocks on write
* @return this (for chained invocation) * @return this (for chained invocation)
@ -902,11 +926,21 @@ public class HColumnDescriptor implements Comparable<HColumnDescriptor> {
/** /**
* @return true if we should cache data blocks in the L1 cache (if block cache deploy * @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). * has more than one tier; e.g. we are using CombinedBlockCache).
* @deprecated Use {@link #isCacheDataInL1()} instead
*/ */
@Deprecated
public boolean shouldCacheDataInL1() { public boolean shouldCacheDataInL1() {
return setAndGetBoolean(CACHE_DATA_IN_L1, DEFAULT_CACHE_DATA_IN_L1); 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 * @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). * has more than one tier; e.g. we are using CombinedBlockCache).
@ -924,11 +958,20 @@ public class HColumnDescriptor implements Comparable<HColumnDescriptor> {
/** /**
* @return true if we should cache index blocks on write * @return true if we should cache index blocks on write
* @deprecated Use {@link #isCacheIndexesOnWrite()} instead
*/ */
@Deprecated
public boolean shouldCacheIndexesOnWrite() { public boolean shouldCacheIndexesOnWrite() {
return setAndGetBoolean(CACHE_INDEX_ON_WRITE, DEFAULT_CACHE_INDEX_ON_WRITE); 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 * @param value true if we should cache index blocks on write
* @return this (for chained invocation) * @return this (for chained invocation)
@ -939,11 +982,20 @@ public class HColumnDescriptor implements Comparable<HColumnDescriptor> {
/** /**
* @return true if we should cache bloomfilter blocks on write * @return true if we should cache bloomfilter blocks on write
* @deprecated Use {@link #isCacheBloomsOnWrite()} instead
*/ */
@Deprecated
public boolean shouldCacheBloomsOnWrite() { public boolean shouldCacheBloomsOnWrite() {
return setAndGetBoolean(CACHE_BLOOMS_ON_WRITE, DEFAULT_CACHE_BLOOMS_ON_WRITE); 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 * @param value true if we should cache bloomfilter blocks on write
* @return this (for chained invocation) * @return this (for chained invocation)
@ -955,11 +1007,20 @@ public class HColumnDescriptor implements Comparable<HColumnDescriptor> {
/** /**
* @return true if we should evict cached blocks from the blockcache on * @return true if we should evict cached blocks from the blockcache on
* close * close
* @deprecated {@link #isEvictBlocksOnClose()} instead
*/ */
@Deprecated
public boolean shouldEvictBlocksOnClose() { public boolean shouldEvictBlocksOnClose() {
return setAndGetBoolean(EVICT_BLOCKS_ON_CLOSE, DEFAULT_EVICT_BLOCKS_ON_CLOSE); 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 * @param value true if we should evict cached blocks from the blockcache on
* close * close
@ -971,11 +1032,20 @@ public class HColumnDescriptor implements Comparable<HColumnDescriptor> {
/** /**
* @return true if we should prefetch blocks into the blockcache on open * @return true if we should prefetch blocks into the blockcache on open
* @deprecated Use {@link #isPrefetchBlocksOnOpen()} instead
*/ */
@Deprecated
public boolean shouldPrefetchBlocksOnOpen() { public boolean shouldPrefetchBlocksOnOpen() {
return setAndGetBoolean(PREFETCH_BLOCKS_ON_OPEN, DEFAULT_PREFETCH_BLOCKS_ON_OPEN); 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 * @param value true if we should prefetch blocks into the blockcache on open
* @return this (for chained invocation) * @return this (for chained invocation)

View File

@ -189,18 +189,18 @@ public class CacheConfig {
// For the following flags we enable them regardless of per-schema settings // For the following flags we enable them regardless of per-schema settings
// if they are enabled in the global configuration. // if they are enabled in the global configuration.
conf.getBoolean(CACHE_BLOCKS_ON_WRITE_KEY, 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, 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, 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, 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(CACHE_DATA_BLOCKS_COMPRESSED_KEY, DEFAULT_CACHE_DATA_COMPRESSED),
conf.getBoolean(PREFETCH_BLOCKS_ON_OPEN_KEY, 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, conf.getBoolean(HColumnDescriptor.CACHE_DATA_IN_L1,
HColumnDescriptor.DEFAULT_CACHE_DATA_IN_L1) || family.shouldCacheDataInL1() HColumnDescriptor.DEFAULT_CACHE_DATA_IN_L1) || family.isCacheDataInL1()
); );
} }

View File

@ -976,7 +976,7 @@ public class HStore implements Store {
.withIncludesMvcc(includeMVCCReadpoint) .withIncludesMvcc(includeMVCCReadpoint)
.withIncludesTags(includesTag) .withIncludesTags(includesTag)
.withCompression(compression) .withCompression(compression)
.withCompressTags(family.shouldCompressTags()) .withCompressTags(family.isCompressTags())
.withChecksumType(checksumType) .withChecksumType(checksumType)
.withBytesPerCheckSum(bytesPerChecksum) .withBytesPerCheckSum(bytesPerChecksum)
.withBlockSize(blocksize) .withBlockSize(blocksize)