You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by st...@apache.org on 2014/10/31 16:34:12 UTC

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

Repository: hbase
Updated Branches:
  refs/heads/master ba7344f5d -> cacdb89e0


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

Signed-off-by: stack <st...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/cacdb89e
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/cacdb89e
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/cacdb89e

Branch: refs/heads/master
Commit: cacdb89e0345d4d507ae0ae04628d871d636fbca
Parents: ba7344f
Author: Ashish Singhi <as...@huawei.com>
Authored: Fri Oct 31 20:42:21 2014 +0530
Committer: stack <st...@apache.org>
Committed: Fri Oct 31 08:34:00 2014 -0700

----------------------------------------------------------------------
 .../apache/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(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/cacdb89e/hbase-client/src/main/java/org/apache/hadoop/hbase/HColumnDescriptor.java
----------------------------------------------------------------------
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 2e560d7..f61a13d 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<HColumnDescriptor> {
   /**
    * @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;
@@ -737,6 +739,19 @@ public class HColumnDescriptor implements Comparable<HColumnDescriptor> {
   }
 
   /**
+   * @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.
    */
   public Compression.Algorithm getCompactionCompressionType() {
@@ -886,12 +901,21 @@ public class HColumnDescriptor implements Comparable<HColumnDescriptor> {
 
   /**
    * @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,12 +926,22 @@ public class HColumnDescriptor implements Comparable<HColumnDescriptor> {
   /**
    * @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).
    * @return this (for chained invocation)
@@ -924,12 +958,21 @@ public class HColumnDescriptor implements Comparable<HColumnDescriptor> {
 
   /**
    * @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,12 +982,21 @@ public class HColumnDescriptor implements Comparable<HColumnDescriptor> {
 
   /**
    * @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,12 +1007,21 @@ public class HColumnDescriptor implements Comparable<HColumnDescriptor> {
   /**
    * @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
    * @return this (for chained invocation)
@@ -971,12 +1032,21 @@ public class HColumnDescriptor implements Comparable<HColumnDescriptor> {
 
   /**
    * @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)
    */

http://git-wip-us.apache.org/repos/asf/hbase/blob/cacdb89e/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/CacheConfig.java
----------------------------------------------------------------------
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 acb1ef5..f212f14 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()
      );
   }
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/cacdb89e/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java
----------------------------------------------------------------------
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 faf2eb1..8b41401 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)