hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ramkris...@apache.org
Subject git commit: HBASE-11027-Remove kv.isDeleteXX() and related methods and use CellUtil apis (Ram)
Date Wed, 25 Jun 2014 11:33:12 GMT
Repository: hbase
Updated Branches:
  refs/heads/master 07a771866 -> b8428a68c


HBASE-11027-Remove kv.isDeleteXX() and related methods and use CellUtil
apis (Ram)


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

Branch: refs/heads/master
Commit: b8428a68c36ba5a775d5634cdaeec30a8b439674
Parents: 07a7718
Author: Ramkrishna <ramkrishna.s.vasudevan@intel.com>
Authored: Wed Jun 25 17:02:18 2014 +0530
Committer: Ramkrishna <ramkrishna.s.vasudevan@intel.com>
Committed: Wed Jun 25 17:02:18 2014 +0530

----------------------------------------------------------------------
 .../java/org/apache/hadoop/hbase/CellUtil.java  | 28 +++++++++++++++++-
 .../java/org/apache/hadoop/hbase/KeyValue.java  | 31 --------------------
 .../regionserver/ExplicitColumnTracker.java     |  6 ++--
 .../GetClosestRowBeforeTracker.java             |  3 +-
 .../hadoop/hbase/regionserver/HRegion.java      |  2 +-
 .../regionserver/ScanWildcardColumnTracker.java |  4 +--
 .../hadoop/hbase/regionserver/StoreFile.java    |  3 +-
 .../hbase/regionserver/TimeRangeTracker.java    |  3 +-
 8 files changed, 39 insertions(+), 41 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/b8428a68/hbase-common/src/main/java/org/apache/hadoop/hbase/CellUtil.java
----------------------------------------------------------------------
diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/CellUtil.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/CellUtil.java
index 1ffb12b..5acf4bd 100644
--- a/hbase-common/src/main/java/org/apache/hadoop/hbase/CellUtil.java
+++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/CellUtil.java
@@ -393,7 +393,24 @@ public final class CellUtil {
    *         {@link KeyValue.Type#DeleteColumn} KeyValue type.
    */
   public static boolean isDelete(final Cell cell) {
-    return KeyValue.isDelete(cell.getTypeByte());
+    return isDelete(cell.getTypeByte());
+  }
+
+  /**
+   * @return True if a delete type, a {@link KeyValue.Type#Delete} or a
+   *         {KeyValue.Type#DeleteFamily} or a
+   *         {@link KeyValue.Type#DeleteColumn} KeyValue type.
+   */
+  public static boolean isDelete(final byte type) {
+    return Type.Delete.getCode() <= type
+        && type <= Type.DeleteFamily.getCode();
+  }
+
+  /**
+   * @return True if this cell is a {@link KeyValue.Type#Delete} type.
+   */
+  public static boolean isDeleteType(Cell cell) {
+    return cell.getTypeByte() == Type.Delete.getCode();
   }
 
   public static boolean isDeleteFamily(final Cell cell) {
@@ -405,6 +422,15 @@ public final class CellUtil {
   }
 
   /**
+   *
+   * @return True if this cell is a delete family or column type.
+   */
+  public static boolean isDeleteColumnOrFamily(Cell cell) {
+    int t = cell.getTypeByte();
+    return t == Type.DeleteColumn.getCode() || t == Type.DeleteFamily.getCode();
+  }
+
+  /**
    * @param cell
    * @return Estimate of the <code>cell</code> size in bytes.
    */

http://git-wip-us.apache.org/repos/asf/hbase/blob/b8428a68/hbase-common/src/main/java/org/apache/hadoop/hbase/KeyValue.java
----------------------------------------------------------------------
diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/KeyValue.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/KeyValue.java
index 0fdd9e4..887946e 100644
--- a/hbase-common/src/main/java/org/apache/hadoop/hbase/KeyValue.java
+++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/KeyValue.java
@@ -1515,37 +1515,6 @@ public class KeyValue implements Cell, HeapSize, Cloneable {
   }
 
   /**
-   * @return True if this KV is a {@link KeyValue.Type#Delete} type.
-   */
-  public boolean isDeleteType() {
-    // TODO: Fix this method name vis-a-vis isDelete!
-    return getTypeByte() == Type.Delete.getCode();
-  }
-
-  /**
-   * @return True if this KV is a delete family type.
-   */
-  public boolean isDeleteFamily() {
-    return getTypeByte() == Type.DeleteFamily.getCode();
-  }
-
-  /**
-   * @return True if this KV is a delete family-version type.
-   */
-  public boolean isDeleteFamilyVersion() {
-    return getTypeByte() == Type.DeleteFamilyVersion.getCode();
-  }
-
-  /**
-   *
-   * @return True if this KV is a delete family or column type.
-   */
-  public boolean isDeleteColumnOrFamily() {
-    int t = getTypeByte();
-    return t == Type.DeleteColumn.getCode() || t == Type.DeleteFamily.getCode();
-  }
-
-  /**
    * Primarily for use client-side.  Returns the family of this KeyValue in a
    * new byte array.<p>
    *

http://git-wip-us.apache.org/repos/asf/hbase/blob/b8428a68/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/ExplicitColumnTracker.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/ExplicitColumnTracker.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/ExplicitColumnTracker.java
index eceade5..dcfa33b 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/ExplicitColumnTracker.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/ExplicitColumnTracker.java
@@ -22,8 +22,8 @@ import java.io.IOException;
 import java.util.NavigableSet;
 
 import org.apache.hadoop.classification.InterfaceAudience;
+import org.apache.hadoop.hbase.CellUtil;
 import org.apache.hadoop.hbase.HConstants;
-import org.apache.hadoop.hbase.KeyValue;
 import org.apache.hadoop.hbase.regionserver.ScanQueryMatcher.MatchCode;
 import org.apache.hadoop.hbase.util.Bytes;
 
@@ -117,7 +117,7 @@ public class ExplicitColumnTracker implements ColumnTracker {
       int length, byte type) {
     // delete markers should never be passed to an
     // *Explicit*ColumnTracker
-    assert !KeyValue.isDelete(type);
+    assert !CellUtil.isDelete(type);
     do {
       // No more columns left, we are done with this query
       if(done()) {
@@ -168,7 +168,7 @@ public class ExplicitColumnTracker implements ColumnTracker {
   @Override
   public ScanQueryMatcher.MatchCode checkVersions(byte[] bytes, int offset, int length,
       long timestamp, byte type, boolean ignoreCount) throws IOException {
-    assert !KeyValue.isDelete(type);
+    assert !CellUtil.isDelete(type);
     if (ignoreCount) return ScanQueryMatcher.MatchCode.INCLUDE;
     // Check if it is a duplicate timestamp
     if (sameAsPreviousTS(timestamp)) {

http://git-wip-us.apache.org/repos/asf/hbase/blob/b8428a68/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/GetClosestRowBeforeTracker.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/GetClosestRowBeforeTracker.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/GetClosestRowBeforeTracker.java
index 6f2c178..18ffd96 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/GetClosestRowBeforeTracker.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/GetClosestRowBeforeTracker.java
@@ -25,6 +25,7 @@ import java.util.TreeSet;
 
 import org.apache.hadoop.classification.InterfaceAudience;
 import org.apache.hadoop.hbase.Cell;
+import org.apache.hadoop.hbase.CellUtil;
 import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.KeyValue;
 import org.apache.hadoop.hbase.KeyValue.KVComparator;
@@ -144,7 +145,7 @@ class GetClosestRowBeforeTracker {
     for (KeyValue d: ds) {
       long kvts = kv.getTimestamp();
       long dts = d.getTimestamp();
-      if (d.isDeleteFamily()) {
+      if (CellUtil.isDeleteFamily(d)) {
         if (kvts <= dts) return true;
         continue;
       }

http://git-wip-us.apache.org/repos/asf/hbase/blob/b8428a68/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
index 309d0c0..aef95d8 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
@@ -2049,7 +2049,7 @@ public class HRegion implements HeapSize { // , Writable{
         KeyValue kv = KeyValueUtil.ensureKeyValue(cell);
         //  Check if time is LATEST, change to time of most recent addition if so
         //  This is expensive.
-        if (kv.isLatestTimestamp() && kv.isDeleteType()) {
+        if (kv.isLatestTimestamp() && CellUtil.isDeleteType(kv)) {
           byte[] qual = CellUtil.cloneQualifier(kv);
           if (qual == null) qual = HConstants.EMPTY_BYTE_ARRAY;
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/b8428a68/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/ScanWildcardColumnTracker.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/ScanWildcardColumnTracker.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/ScanWildcardColumnTracker.java
index b8a6f5d..5af2f9f 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/ScanWildcardColumnTracker.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/ScanWildcardColumnTracker.java
@@ -22,8 +22,8 @@ package org.apache.hadoop.hbase.regionserver;
 import java.io.IOException;
 
 import org.apache.hadoop.classification.InterfaceAudience;
+import org.apache.hadoop.hbase.CellUtil;
 import org.apache.hadoop.hbase.HConstants;
-import org.apache.hadoop.hbase.KeyValue;
 import org.apache.hadoop.hbase.regionserver.ScanQueryMatcher.MatchCode;
 import org.apache.hadoop.hbase.util.Bytes;
 
@@ -134,7 +134,7 @@ public class ScanWildcardColumnTracker implements ColumnTracker {
    * Increase the version counter unless this is a delete
    */
   private MatchCode checkVersion(byte type, long timestamp) {
-    if (!KeyValue.isDelete(type)) {
+    if (!CellUtil.isDelete(type)) {
       currentCount++;
     }
     if (currentCount > maxVersions) {

http://git-wip-us.apache.org/repos/asf/hbase/blob/b8428a68/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFile.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFile.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFile.java
index 34e1d5d..ec164ca 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFile.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFile.java
@@ -37,6 +37,7 @@ import org.apache.hadoop.classification.InterfaceAudience;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hbase.CellUtil;
 import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.HDFSBlocksDistribution;
 import org.apache.hadoop.hbase.KeyValue;
@@ -883,7 +884,7 @@ public class StoreFile {
 
     private void appendDeleteFamilyBloomFilter(final KeyValue kv)
         throws IOException {
-      if (!kv.isDeleteFamily() && !kv.isDeleteFamilyVersion()) {
+      if (!CellUtil.isDeleteFamily(kv) && !CellUtil.isDeleteFamilyVersion(kv)) {
         return;
       }
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/b8428a68/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/TimeRangeTracker.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/TimeRangeTracker.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/TimeRangeTracker.java
index 7fef0fd..1546c55 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/TimeRangeTracker.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/TimeRangeTracker.java
@@ -23,6 +23,7 @@ import java.io.DataOutput;
 import java.io.IOException;
 
 import org.apache.hadoop.classification.InterfaceAudience;
+import org.apache.hadoop.hbase.CellUtil;
 import org.apache.hadoop.hbase.KeyValue;
 import org.apache.hadoop.hbase.KeyValue.Type;
 import org.apache.hadoop.hbase.io.TimeRange;
@@ -72,7 +73,7 @@ public class TimeRangeTracker implements Writable {
    */
   public void includeTimestamp(final KeyValue kv) {
     includeTimestamp(kv.getTimestamp());
-    if (kv.isDeleteColumnOrFamily()) {
+    if (CellUtil.isDeleteColumnOrFamily(kv)) {
       includeTimestamp(0);
     }
   }


Mime
View raw message