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 1ffb12b620b..5acf4bd29eb 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) {
@@ -404,6 +421,15 @@ public final class CellUtil {
return cell.getTypeByte() == Type.DeleteFamilyVersion.getCode();
}
+ /**
+ *
+ * @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 cell
size in bytes.
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 0fdd9e46c18..887946e3d89 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
@@ -1514,37 +1514,6 @@ public class KeyValue implements Cell, HeapSize, Cloneable {
return KeyValue.isDelete(getType());
}
- /**
- * @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.
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 eceade5c79f..dcfa33ba749 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)) { 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 6f2c1787c45..18ffd96c3ec 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; } 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 309d0c0b6bf..aef95d886a2 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; 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 b8a6f5d7e24..5af2f9f54cb 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) { 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 34e1d5dc1f6..ec164ca4158 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; } 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 7fef0fdc7fa..1546c55e3e5 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); } }