Index: hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderV2.java =================================================================== --- hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderV2.java (revision 1375379) +++ hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderV2.java (working copy) @@ -606,7 +606,9 @@ return null; KeyValue ret = new KeyValue(blockBuffer.array(), - blockBuffer.arrayOffset() + blockBuffer.position()); + blockBuffer.arrayOffset() + blockBuffer.position(), + KEY_VALUE_LEN_SIZE + currKeyLen + currValueLen, + currKeyLen); if (this.reader.shouldIncludeMemstoreTS()) { ret.setMemstoreTS(currMemstoreTS); } Index: hbase-common/src/main/java/org/apache/hadoop/hbase/KeyValue.java =================================================================== --- hbase-common/src/main/java/org/apache/hadoop/hbase/KeyValue.java (revision 1375379) +++ hbase-common/src/main/java/org/apache/hadoop/hbase/KeyValue.java (working copy) @@ -316,6 +316,21 @@ this.length = length; } + /** + * Creates a KeyValue from the specified byte array, starting at offset, + * for length length, and a known keyLength. + * @param bytes byte array + * @param offset offset to start of the KeyValue + * @param length length of the KeyValue + * @param keyLength length of the key portion of the KeyValue + */ + public KeyValue(final byte [] bytes, final int offset, final int length, final int keyLength) { + this.bytes = bytes; + this.offset = offset; + this.length = length; + this.keyLength = keyLength; + } + /** Constructors that build a new backing byte array from fields */ /**