HBASE-16809 Save one cell length calculation in HeapMemStoreLAB#copyCellInto. (binlijin)

This commit is contained in:
anoopsamjohn 2016-10-12 09:57:23 +05:30
parent 0af10f8942
commit f77ff9f96f
2 changed files with 3 additions and 5 deletions

View File

@ -661,10 +661,8 @@ public class KeyValueUtil {
* Write the given cell in KeyValue serialization format into the given buf and return a new
* KeyValue object around that.
*/
public static KeyValue copyCellTo(Cell cell, byte[] buf, int offset) {
public static KeyValue copyCellTo(Cell cell, byte[] buf, int offset, int len) {
int tagsLen = cell.getTagsLength();
int len = length(cell.getRowLength(), cell.getFamilyLength(), cell.getQualifierLength(),
cell.getValueLength(), tagsLen, true);
if (cell instanceof ExtendedCell) {
((ExtendedCell) cell).write(buf, offset);
} else {

View File

@ -26,11 +26,11 @@ import java.util.concurrent.atomic.AtomicReference;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.KeyValueUtil;
import org.apache.hadoop.hbase.classification.InterfaceAudience;
import org.apache.hadoop.hbase.regionserver.MemStoreChunkPool.PooledChunk;
import org.apache.hadoop.conf.Configuration;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Preconditions;
@ -130,7 +130,7 @@ public class HeapMemStoreLAB implements MemStoreLAB {
// try to retire this chunk
tryRetireChunk(c);
}
return KeyValueUtil.copyCellTo(cell, c.getData(), allocOffset);
return KeyValueUtil.copyCellTo(cell, c.getData(), allocOffset, size);
}
/**