HBASE-13630 - Remove dead code in BufferedDataEncoder (Ram)

This commit is contained in:
ramkrishna 2015-05-08 09:15:46 +05:30
parent 11b76732c0
commit 52f635df00
1 changed files with 44 additions and 53 deletions

View File

@ -700,68 +700,59 @@ abstract class BufferedDataBlockEncoder implements DataBlockEncoder {
KeyValue.KeyOnlyKeyValue currentCell = new KeyValue.KeyOnlyKeyValue(); KeyValue.KeyOnlyKeyValue currentCell = new KeyValue.KeyOnlyKeyValue();
do { do {
int comp; int comp;
if (comparator != null) { currentCell.setKey(current.keyBuffer, 0, current.keyLength);
currentCell.setKey(current.keyBuffer, 0, current.keyLength); if (current.lastCommonPrefix != 0) {
if (current.lastCommonPrefix != 0) { // The KV format has row key length also in the byte array. The
// The KV format has row key length also in the byte array. The // common prefix
// common prefix // includes it. So we need to subtract to find out the common prefix
// includes it. So we need to subtract to find out the common prefix // in the
// in the // row part alone
// row part alone rowCommonPrefix = Math.min(rowCommonPrefix, current.lastCommonPrefix - 2);
rowCommonPrefix = Math.min(rowCommonPrefix, current.lastCommonPrefix - 2); }
} if (current.lastCommonPrefix <= 2) {
if (current.lastCommonPrefix <= 2) { rowCommonPrefix = 0;
rowCommonPrefix = 0; }
} rowCommonPrefix += findCommonPrefixInRowPart(seekCell, currentCell, rowCommonPrefix);
rowCommonPrefix += findCommonPrefixInRowPart(seekCell, currentCell, comp = compareCommonRowPrefix(seekCell, currentCell, rowCommonPrefix);
rowCommonPrefix); if (comp == 0) {
comp = compareCommonRowPrefix(seekCell, currentCell, comp = compareTypeBytes(seekCell, currentCell);
rowCommonPrefix);
if (comp == 0) { if (comp == 0) {
comp = compareTypeBytes(seekCell, currentCell); // Subtract the fixed row key length and the family key fixed length
familyCommonPrefix = Math.max(
0,
Math.min(familyCommonPrefix,
current.lastCommonPrefix - (3 + currentCell.getRowLength())));
familyCommonPrefix += findCommonPrefixInFamilyPart(seekCell, currentCell,
familyCommonPrefix);
comp = compareCommonFamilyPrefix(seekCell, currentCell, familyCommonPrefix);
if (comp == 0) { if (comp == 0) {
// Subtract the fixed row key length and the family key fixed length // subtract the rowkey fixed length and the family key fixed
familyCommonPrefix = Math.max( // length
qualCommonPrefix = Math.max(
0, 0,
Math.min(familyCommonPrefix, Math.min(
current.lastCommonPrefix - (3 + currentCell.getRowLength()))); qualCommonPrefix,
familyCommonPrefix += findCommonPrefixInFamilyPart(seekCell, current.lastCommonPrefix
currentCell, familyCommonPrefix); - (3 + currentCell.getRowLength() + currentCell.getFamilyLength())));
comp = compareCommonFamilyPrefix(seekCell, currentCell, qualCommonPrefix += findCommonPrefixInQualifierPart(seekCell, currentCell,
familyCommonPrefix); qualCommonPrefix);
comp = compareCommonQualifierPrefix(seekCell, currentCell, qualCommonPrefix);
if (comp == 0) { if (comp == 0) {
// subtract the rowkey fixed length and the family key fixed comp = CellComparator.compareTimestamps(seekCell, currentCell);
// length
qualCommonPrefix = Math.max(
0,
Math.min(
qualCommonPrefix,
current.lastCommonPrefix
- (3 + currentCell.getRowLength() + currentCell.getFamilyLength())));
qualCommonPrefix += findCommonPrefixInQualifierPart(seekCell,
currentCell, qualCommonPrefix);
comp = compareCommonQualifierPrefix(seekCell, currentCell,
qualCommonPrefix);
if (comp == 0) { if (comp == 0) {
comp = CellComparator.compareTimestamps(seekCell, currentCell); // Compare types. Let the delete types sort ahead of puts;
if (comp == 0) { // i.e. types
// Compare types. Let the delete types sort ahead of puts; // of higher numbers sort before those of lesser numbers.
// i.e. types // Maximum
// of higher numbers sort before those of lesser numbers. // (255)
// Maximum // appears ahead of everything, and minimum (0) appears
// (255) // after
// appears ahead of everything, and minimum (0) appears // everything.
// after comp = (0xff & currentCell.getTypeByte()) - (0xff & seekCell.getTypeByte());
// everything.
comp = (0xff & currentCell.getTypeByte()) - (0xff & seekCell.getTypeByte());
}
} }
} }
} }
} }
} else {
Cell r = new KeyValue.KeyOnlyKeyValue(current.keyBuffer, 0, current.keyLength);
comp = comparator.compareKeyIgnoresMvcc(seekCell, r);
} }
if (comp == 0) { // exact match if (comp == 0) { // exact match
if (seekBefore) { if (seekBefore) {