iHBASE-16792 Reuse KeyValue.KeyOnlyKeyValue in
BufferedDataBlockEncoder.SeekerState (Binlijin)
This commit is contained in:
parent
9a94dc90b4
commit
4127fd2a7c
|
@ -43,6 +43,7 @@ import org.apache.hadoop.hbase.util.Bytes;
|
|||
import org.apache.hadoop.hbase.util.ClassSize;
|
||||
import org.apache.hadoop.io.IOUtils;
|
||||
import org.apache.hadoop.io.RawComparator;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
|
||||
/**
|
||||
|
@ -2641,6 +2642,20 @@ public class KeyValue implements ExtendedCell {
|
|||
this.rowLen = Bytes.toShort(this.bytes, this.offset);
|
||||
}
|
||||
|
||||
public void set(KeyOnlyKeyValue keyOnlyKeyValue) {
|
||||
this.bytes = keyOnlyKeyValue.bytes;
|
||||
this.length = keyOnlyKeyValue.length;
|
||||
this.offset = keyOnlyKeyValue.offset;
|
||||
this.rowLen = keyOnlyKeyValue.rowLen;
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
rowLen = -1;
|
||||
bytes = null;
|
||||
offset = 0;
|
||||
length = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getKeyOffset() {
|
||||
return this.offset;
|
||||
|
|
|
@ -139,7 +139,7 @@ abstract class BufferedDataBlockEncoder extends AbstractDataBlockEncoder {
|
|||
protected void invalidate() {
|
||||
valueOffset = -1;
|
||||
tagsCompressedLength = 0;
|
||||
currentKey = new KeyValue.KeyOnlyKeyValue();
|
||||
currentKey.clear();
|
||||
uncompressTags = true;
|
||||
currentBuffer = null;
|
||||
}
|
||||
|
@ -188,7 +188,7 @@ abstract class BufferedDataBlockEncoder extends AbstractDataBlockEncoder {
|
|||
keyBuffer, nextState.lastCommonPrefix, nextState.keyLength
|
||||
- nextState.lastCommonPrefix);
|
||||
}
|
||||
currentKey = nextState.currentKey;
|
||||
currentKey.set(nextState.currentKey);
|
||||
|
||||
valueOffset = nextState.valueOffset;
|
||||
keyLength = nextState.keyLength;
|
||||
|
|
Loading…
Reference in New Issue