.../src/main/java/org/apache/hadoop/hbase/OffheapKeyValue.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/OffheapKeyValue.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/OffheapKeyValue.java index ab1f6ef..2e15c9a 100644 --- a/hbase-common/src/main/java/org/apache/hadoop/hbase/OffheapKeyValue.java +++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/OffheapKeyValue.java @@ -40,7 +40,7 @@ public class OffheapKeyValue extends ByteBufferCell implements ExtendedCell { private final short rowLen; private final int keyLen; private long seqId = 0; - // TODO : See if famLen can be cached or not? + private final byte famLen; private static final int FIXED_OVERHEAD = ClassSize.OBJECT + ClassSize.REFERENCE + (3 * Bytes.SIZEOF_INT) + Bytes.SIZEOF_SHORT @@ -55,6 +55,7 @@ public class OffheapKeyValue extends ByteBufferCell implements ExtendedCell { keyLen = ByteBufferUtils.toInt(this.buf, this.offset); this.hasTags = hasTags; this.seqId = seqId; + this.famLen = ByteBufferUtils.toByte(this.buf, getFamilyLengthPosition()); } public OffheapKeyValue(ByteBuffer buf, int offset, int length) { @@ -67,6 +68,7 @@ public class OffheapKeyValue extends ByteBufferCell implements ExtendedCell { int tagsLen = this.length - (this.keyLen + getValueLength() + KeyValue.KEYVALUE_INFRASTRUCTURE_SIZE); this.hasTags = tagsLen > 0; + this.famLen = ByteBufferUtils.toByte(this.buf, getFamilyLengthPosition()); } @Override @@ -96,17 +98,13 @@ public class OffheapKeyValue extends ByteBufferCell implements ExtendedCell { @Override public byte getFamilyLength() { - return getFamilyLength(getFamilyLengthPosition()); + return famLen; } private int getFamilyLengthPosition() { return this.offset + KeyValue.ROW_KEY_OFFSET + rowLen; } - private byte getFamilyLength(int famLenPos) { - return ByteBufferUtils.toByte(this.buf, famLenPos); - } - @Override public byte[] getQualifierArray() { return CellUtil.cloneQualifier(this);