HBASE-11027-Remove kv.isDeleteXX() and related methods and use CellUtil
apis (Ram)
This commit is contained in:
parent
07a771866f
commit
b8428a68c3
|
@ -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 <code>cell</code> size in bytes.
|
||||
|
|
|
@ -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.<p>
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue