You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by la...@apache.org on 2012/08/21 19:06:08 UTC
svn commit: r1375665 - in
/hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase: KeyValue.java
io/hfile/HFileReaderV2.java
Author: larsh
Date: Tue Aug 21 17:06:07 2012
New Revision: 1375665
URL: http://svn.apache.org/viewvc?rev=1375665&view=rev
Log:
HBASE-6621 Reduce calls to Bytes.toInt
Modified:
hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/KeyValue.java
hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderV2.java
Modified: hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/KeyValue.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/KeyValue.java?rev=1375665&r1=1375664&r2=1375665&view=diff
==============================================================================
--- hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/KeyValue.java (original)
+++ hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/KeyValue.java Tue Aug 21 17:06:07 2012
@@ -281,6 +281,21 @@ public class KeyValue implements Writabl
this.length = length;
}
+ /**
+ * Creates a KeyValue from the specified byte array, starting at offset,
+ * for length <code>length</code>, and a known <code>keyLength</code>.
+ * @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 */
/**
Modified: hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderV2.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderV2.java?rev=1375665&r1=1375664&r2=1375665&view=diff
==============================================================================
--- hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderV2.java (original)
+++ hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderV2.java Tue Aug 21 17:06:07 2012
@@ -581,7 +581,9 @@ public class HFileReaderV2 extends Abstr
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);
}