HBASE-16792 Reuse KeyValue.KeyOnlyKeyValue in

BufferedDataBlockEncoder.SeekerState (Binlijin)
This commit is contained in:
Ramkrishna 2016-10-13 10:11:27 +05:30
parent 92ef234486
commit f11aa4542f
2 changed files with 9 additions and 1 deletions

View File

@ -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,13 @@ public class KeyValue implements ExtendedCell {
this.rowLen = Bytes.toShort(this.bytes, this.offset);
}
public void clear() {
rowLen = -1;
bytes = null;
offset = 0;
length = 0;
}
@Override
public int getKeyOffset() {
return this.offset;

View File

@ -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;
}