HBASE-14186 Read mvcc vlong optimization.

This commit is contained in:
anoopsjohn 2015-08-06 10:16:51 +05:30
parent 18c9bb8b54
commit 5d2708f628
1 changed files with 14 additions and 1 deletions

View File

@ -633,9 +633,22 @@ public class HFileReaderImpl implements HFile.Reader, Configurable {
if (len == 1) { if (len == 1) {
this.currMemstoreTS = firstByte; this.currMemstoreTS = firstByte;
} else { } else {
int remaining = len -1;
long i = 0; long i = 0;
offsetFromPos++; offsetFromPos++;
for (int idx = 0; idx < len - 1; idx++) { if (remaining >= Bytes.SIZEOF_INT) {
i = blockBuffer.getIntAfterPosition(offsetFromPos);
remaining -= Bytes.SIZEOF_INT;
offsetFromPos += Bytes.SIZEOF_INT;
}
if (remaining >= Bytes.SIZEOF_SHORT) {
short s = blockBuffer.getShortAfterPosition(offsetFromPos);
i = i << 16;
i = i | (s & 0xFFFF);
remaining -= Bytes.SIZEOF_SHORT;
offsetFromPos += Bytes.SIZEOF_SHORT;
}
for (int idx = 0; idx < remaining; idx++) {
byte b = blockBuffer.getByteAfterPosition(offsetFromPos + idx); byte b = blockBuffer.getByteAfterPosition(offsetFromPos + idx);
i = i << 8; i = i << 8;
i = i | (b & 0xFF); i = i | (b & 0xFF);