HBASE-10929 - Addendum that extracts out qualifierOffset, qualifierLength and timestamp

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1589590 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
ramkrishna 2014-04-24 05:24:49 +00:00
parent ece91da0d2
commit b733180663
1 changed files with 27 additions and 22 deletions

View File

@ -278,10 +278,13 @@ public class ScanQueryMatcher {
return MatchCode.SEEK_NEXT_ROW; return MatchCode.SEEK_NEXT_ROW;
} }
int qualifierOffset = cell.getQualifierOffset();
int qualifierLength = cell.getQualifierLength();
long timestamp = cell.getTimestamp();
// check for early out based on timestamp alone // check for early out based on timestamp alone
if (columns.isDone(cell.getTimestamp())) { if (columns.isDone(timestamp)) {
return columns.getNextRowOrNextColumn(cell.getQualifierArray(), cell.getQualifierOffset(), return columns.getNextRowOrNextColumn(cell.getQualifierArray(), qualifierOffset,
cell.getQualifierLength()); qualifierLength);
} }
/* /*
@ -297,6 +300,8 @@ public class ScanQueryMatcher {
* 7. Delete marker need to be version counted together with puts * 7. Delete marker need to be version counted together with puts
* they affect * they affect
*/ */
byte typeByte = cell.getTypeByte();
long mvccVersion = cell.getMvccVersion();
if (CellUtil.isDelete(cell)) { if (CellUtil.isDelete(cell)) {
if (!keepDeletedCells) { if (!keepDeletedCells) {
// first ignore delete markers if the scanner can do so, and the // first ignore delete markers if the scanner can do so, and the
@ -306,22 +311,22 @@ public class ScanQueryMatcher {
// than the readpoint of any open scanner, this prevents deleted // than the readpoint of any open scanner, this prevents deleted
// rows that could still be seen by a scanner from being collected // rows that could still be seen by a scanner from being collected
boolean includeDeleteMarker = seePastDeleteMarkers ? boolean includeDeleteMarker = seePastDeleteMarkers ?
tr.withinTimeRange(cell.getTimestamp()) : tr.withinTimeRange(timestamp) :
tr.withinOrAfterTimeRange(cell.getTimestamp()); tr.withinOrAfterTimeRange(timestamp);
if (includeDeleteMarker if (includeDeleteMarker
&& cell.getMvccVersion() <= maxReadPointToTrackVersions) { && mvccVersion <= maxReadPointToTrackVersions) {
this.deletes.add(cell.getQualifierArray(), cell.getQualifierOffset(), this.deletes.add(cell.getQualifierArray(), qualifierOffset,
cell.getQualifierLength(), cell.getTimestamp(), cell.getTypeByte()); qualifierLength, timestamp, typeByte);
} }
// Can't early out now, because DelFam come before any other keys // Can't early out now, because DelFam come before any other keys
} }
if ((!isUserScan) if ((!isUserScan)
&& timeToPurgeDeletes > 0 && timeToPurgeDeletes > 0
&& (EnvironmentEdgeManager.currentTimeMillis() - cell.getTimestamp()) && (EnvironmentEdgeManager.currentTimeMillis() - timestamp)
<= timeToPurgeDeletes) { <= timeToPurgeDeletes) {
return MatchCode.INCLUDE; return MatchCode.INCLUDE;
} else if (retainDeletesInOutput || cell.getMvccVersion() > maxReadPointToTrackVersions) { } else if (retainDeletesInOutput || mvccVersion > maxReadPointToTrackVersions) {
// always include or it is not time yet to check whether it is OK // always include or it is not time yet to check whether it is OK
// to purge deltes or not // to purge deltes or not
if (!isUserScan) { if (!isUserScan) {
@ -330,11 +335,11 @@ public class ScanQueryMatcher {
return MatchCode.INCLUDE; return MatchCode.INCLUDE;
} }
} else if (keepDeletedCells) { } else if (keepDeletedCells) {
if (cell.getTimestamp() < earliestPutTs) { if (timestamp < earliestPutTs) {
// keeping delete rows, but there are no puts older than // keeping delete rows, but there are no puts older than
// this delete in the store files. // this delete in the store files.
return columns.getNextRowOrNextColumn(cell.getQualifierArray(), return columns.getNextRowOrNextColumn(cell.getQualifierArray(),
cell.getQualifierOffset(), cell.getQualifierLength()); qualifierOffset, qualifierLength);
} }
// else: fall through and do version counting on the // else: fall through and do version counting on the
// delete markers // delete markers
@ -345,12 +350,12 @@ public class ScanQueryMatcher {
// delete marker are not subject to other delete markers // delete marker are not subject to other delete markers
} else if (!this.deletes.isEmpty()) { } else if (!this.deletes.isEmpty()) {
DeleteResult deleteResult = deletes.isDeleted(cell.getQualifierArray(), DeleteResult deleteResult = deletes.isDeleted(cell.getQualifierArray(),
cell.getQualifierOffset(), cell.getQualifierLength(), cell.getTimestamp()); qualifierOffset, qualifierLength, timestamp);
switch (deleteResult) { switch (deleteResult) {
case FAMILY_DELETED: case FAMILY_DELETED:
case COLUMN_DELETED: case COLUMN_DELETED:
return columns.getNextRowOrNextColumn(cell.getQualifierArray(), return columns.getNextRowOrNextColumn(cell.getQualifierArray(),
cell.getQualifierOffset(), cell.getQualifierLength()); qualifierOffset, qualifierLength);
case VERSION_DELETED: case VERSION_DELETED:
case FAMILY_VERSION_DELETED: case FAMILY_VERSION_DELETED:
return MatchCode.SKIP; return MatchCode.SKIP;
@ -361,17 +366,17 @@ public class ScanQueryMatcher {
} }
} }
int timestampComparison = tr.compare(cell.getTimestamp()); int timestampComparison = tr.compare(timestamp);
if (timestampComparison >= 1) { if (timestampComparison >= 1) {
return MatchCode.SKIP; return MatchCode.SKIP;
} else if (timestampComparison <= -1) { } else if (timestampComparison <= -1) {
return columns.getNextRowOrNextColumn(cell.getQualifierArray(), cell.getQualifierOffset(), return columns.getNextRowOrNextColumn(cell.getQualifierArray(), qualifierOffset,
cell.getQualifierLength()); qualifierLength);
} }
// STEP 1: Check if the column is part of the requested columns // STEP 1: Check if the column is part of the requested columns
MatchCode colChecker = columns.checkColumn(cell.getQualifierArray(), MatchCode colChecker = columns.checkColumn(cell.getQualifierArray(),
cell.getQualifierOffset(), cell.getQualifierLength(), cell.getTypeByte()); qualifierOffset, qualifierLength, typeByte);
if (colChecker == MatchCode.INCLUDE) { if (colChecker == MatchCode.INCLUDE) {
ReturnCode filterResponse = ReturnCode.SKIP; ReturnCode filterResponse = ReturnCode.SKIP;
// STEP 2: Yes, the column is part of the requested columns. Check if filter is present // STEP 2: Yes, the column is part of the requested columns. Check if filter is present
@ -383,7 +388,7 @@ public class ScanQueryMatcher {
return MatchCode.SKIP; return MatchCode.SKIP;
case NEXT_COL: case NEXT_COL:
return columns.getNextRowOrNextColumn(cell.getQualifierArray(), return columns.getNextRowOrNextColumn(cell.getQualifierArray(),
cell.getQualifierOffset(), cell.getQualifierLength()); qualifierOffset, qualifierLength);
case NEXT_ROW: case NEXT_ROW:
stickyNextRow = true; stickyNextRow = true;
return MatchCode.SEEK_NEXT_ROW; return MatchCode.SEEK_NEXT_ROW;
@ -414,9 +419,9 @@ public class ScanQueryMatcher {
* FilterResponse (INCLUDE_AND_SEEK_NEXT_COL) and ColumnChecker(INCLUDE) * FilterResponse (INCLUDE_AND_SEEK_NEXT_COL) and ColumnChecker(INCLUDE)
*/ */
colChecker = colChecker =
columns.checkVersions(cell.getQualifierArray(), cell.getQualifierOffset(), columns.checkVersions(cell.getQualifierArray(), qualifierOffset,
cell.getQualifierLength(), cell.getTimestamp(), cell.getTypeByte(), qualifierLength, timestamp, typeByte,
cell.getMvccVersion() > maxReadPointToTrackVersions); mvccVersion > maxReadPointToTrackVersions);
//Optimize with stickyNextRow //Optimize with stickyNextRow
stickyNextRow = colChecker == MatchCode.INCLUDE_AND_SEEK_NEXT_ROW ? true : stickyNextRow; stickyNextRow = colChecker == MatchCode.INCLUDE_AND_SEEK_NEXT_ROW ? true : stickyNextRow;
return (filterResponse == ReturnCode.INCLUDE_AND_NEXT_COL && return (filterResponse == ReturnCode.INCLUDE_AND_NEXT_COL &&