HBASE-16659 Use CellUtil.createFirstOnRow instead of KeyValueUtil.createFirstOnRow in some places (binlijin)

This commit is contained in:
chenheng 2016-09-21 15:25:36 +08:00
parent 6624c676fe
commit c67983ebf8
5 changed files with 9 additions and 11 deletions

View File

@ -25,7 +25,7 @@ import java.util.PriorityQueue;
import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.CellComparator;
import org.apache.hadoop.hbase.KeyValueUtil;
import org.apache.hadoop.hbase.CellUtil;
import org.apache.hadoop.hbase.classification.InterfaceAudience;
import org.apache.hadoop.hbase.classification.InterfaceStability;
import org.apache.hadoop.hbase.exceptions.DeserializationException;
@ -175,7 +175,7 @@ public class FuzzyRowFilter extends FilterBase {
return null;
}
byte[] nextRowKey = tracker.nextRow();
return KeyValueUtil.createFirstOnRow(nextRowKey);
return CellUtil.createFirstOnRow(nextRowKey, 0, (short) nextRowKey.length);
}
/**

View File

@ -25,7 +25,6 @@ import java.util.List;
import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.CellUtil;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.KeyValueUtil;
import org.apache.hadoop.hbase.classification.InterfaceAudience;
import org.apache.hadoop.hbase.classification.InterfaceStability;
import org.apache.hadoop.hbase.exceptions.DeserializationException;
@ -138,7 +137,8 @@ public class MultiRowRangeFilter extends FilterBase {
@Override
public Cell getNextCellHint(Cell currentKV) {
// skip to the next range's start row
return KeyValueUtil.createFirstOnRow(range.startRow);
return CellUtil.createFirstOnRow(range.startRow, 0,
(short) range.startRow.length);
}
/**

View File

@ -6216,7 +6216,7 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
}
boolean result = false;
startRegionOperation();
KeyValue kv = KeyValueUtil.createFirstOnRow(row);
Cell kv = CellUtil.createFirstOnRow(row, 0, (short) row.length);
try {
// use request seek to make use of the lazy seek option. See HBASE-5520
result = this.storeHeap.requestSeek(kv, true, true);

View File

@ -21,10 +21,9 @@ package org.apache.hadoop.hbase.regionserver;
import java.io.IOException;
import java.util.List;
import org.apache.hadoop.hbase.classification.InterfaceAudience;
import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.CellUtil;
import org.apache.hadoop.hbase.KeyValueUtil;
import org.apache.hadoop.hbase.classification.InterfaceAudience;
import org.apache.hadoop.hbase.client.Scan;
import org.apache.hadoop.hbase.regionserver.HRegion.RegionScannerImpl;
@ -67,9 +66,7 @@ class ReversedRegionScannerImpl extends RegionScannerImpl {
protected boolean nextRow(ScannerContext scannerContext, Cell curRowCell)
throws IOException {
assert super.joinedContinuationRow == null : "Trying to go to next row during joinedHeap read.";
byte[] row = new byte[curRowCell.getRowLength()];
CellUtil.copyRowTo(curRowCell, row, 0);
this.storeHeap.seekToPreviousRow(KeyValueUtil.createFirstOnRow(row));
this.storeHeap.seekToPreviousRow(CellUtil.createFirstOnRow(curRowCell));
resetFilters();
// Calling the hook in CP which allows it to do a fast forward
if (this.region.getCoprocessorHost() != null) {

View File

@ -506,7 +506,8 @@ public class StoreFileScanner implements KeyValueScanner {
if (lastRow == null) {
return false;
}
KeyValue seekKey = KeyValueUtil.createFirstOnRow(lastRow);
Cell seekKey = CellUtil
.createFirstOnRow(lastRow, 0, (short) lastRow.length);
if (seek(seekKey)) {
return true;
} else {