Class ScanQueryMatcher
java.lang.Object
org.apache.hadoop.hbase.regionserver.querymatcher.ScanQueryMatcher
- All Implemented Interfaces:
ShipperListener
- Direct Known Subclasses:
CompactionScanQueryMatcher
,UserScanQueryMatcher
A query matcher that is specifically designed for the scan case.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
match(org.apache.hadoop.hbase.ExtendedCell)
return codes. -
Field Summary
Modifier and TypeFieldDescriptionprotected final ColumnTracker
Keeps track of columns and versionsprotected ExtendedCell
Row the query is onprotected final long
protected final long
The oldest timestamp we are interested in, based on TTLprotected final CellComparator
Row comparator for the region this query is forprotected final ExtendedCell
Key to seek to in memstore and StoreFiles -
Constructor Summary
ModifierConstructorDescriptionprotected
ScanQueryMatcher
(ExtendedCell startKey, ScanInfo scanInfo, ColumnTracker columns, long oldestUnexpiredTS, long now) -
Method Summary
Modifier and TypeMethodDescriptionvoid
The action that needs to be performed beforeShipper.shipped()
is performed(package private) static ScanQueryMatcher.MatchCode
checkColumn
(ColumnTracker columnTracker, byte[] bytes, int offset, int length, long ttl, byte type, boolean ignoreCount) protected final ScanQueryMatcher.MatchCode
checkDeleted
(DeleteTracker deletes, ExtendedCell cell) void
MakecurrentRow()
return null.int
compareKeyForNextColumn
(ExtendedCell nextIndexed, ExtendedCell currentCell) int
compareKeyForNextRow
(ExtendedCell nextIndexed, ExtendedCell currentCell) protected static ExtendedCell
createStartKeyFromRow
(byte[] startRow, ScanInfo scanInfo) Returns a cell represent the current rowabstract Filter
Returns the Filterabstract ExtendedCell
getNextKeyHint
(ExtendedCell cell) Delegate toFilter.getNextCellHint(Cell)
.Returns the start keyprotected static Pair<DeleteTracker,
ColumnTracker> getTrackers
(RegionCoprocessorHost host, NavigableSet<byte[]> columns, ScanInfo scanInfo, long oldestUnexpiredTS, Scan userScan) abstract boolean
Returns whether there is an null column in the queryprivate static boolean
isCellTTLExpired
(ExtendedCell cell, long oldestTimestamp, long now) Returns true if the cell is expiredabstract boolean
abstract ScanQueryMatcher.MatchCode
match
(ExtendedCell cell) Determines if the caller should do one of several things: seek/skip to the next row (MatchCode.SEEK_NEXT_ROW) seek/skip to the next column (MatchCode.SEEK_NEXT_COL) include the current KeyValue (MatchCode.INCLUDE) ignore the current KeyValue (MatchCode.SKIP) got to the next row (MatchCode.DONE)abstract boolean
protected final ScanQueryMatcher.MatchCode
preCheck
(ExtendedCell cell) Check before the delete logic.protected abstract void
reset()
void
setToNewRow
(ExtendedCell currentRow) Set the row when there is change in row
-
Field Details
-
rowComparator
Row comparator for the region this query is for -
startKey
Key to seek to in memstore and StoreFiles -
columns
Keeps track of columns and versions -
oldestUnexpiredTS
The oldest timestamp we are interested in, based on TTL -
now
-
currentRow
Row the query is on
-
-
Constructor Details
-
ScanQueryMatcher
protected ScanQueryMatcher(ExtendedCell startKey, ScanInfo scanInfo, ColumnTracker columns, long oldestUnexpiredTS, long now)
-
-
Method Details
-
isCellTTLExpired
Returns true if the cell is expired -
preCheck
Check before the delete logic.- Returns:
- null means continue.
-
checkDeleted
-
match
Determines if the caller should do one of several things:- seek/skip to the next row (MatchCode.SEEK_NEXT_ROW)
- seek/skip to the next column (MatchCode.SEEK_NEXT_COL)
- include the current KeyValue (MatchCode.INCLUDE)
- ignore the current KeyValue (MatchCode.SKIP)
- got to the next row (MatchCode.DONE)
- Parameters:
cell
- KeyValue to check- Returns:
- The match code instance.
- Throws:
IOException
- in case there is an internal consistency problem caused by a data corruption.
-
getStartKey
Returns the start key -
hasNullColumnInQuery
Returns whether there is an null column in the query -
currentRow
Returns a cell represent the current row -
clearCurrentRow
MakecurrentRow()
return null. -
reset
-
setToNewRow
Set the row when there is change in row -
isUserScan
-
moreRowsMayExistAfter
- Returns:
- Returns false if we know there are no more rows to be scanned (We've reached the
stopRow
or we are scanning on row only because this Scan is for a Get, etc.
-
getKeyForNextColumn
-
compareKeyForNextRow
- Parameters:
nextIndexed
- the key of the next entry in the block index (if any)currentCell
- The Cell we're using to calculate the seek key- Returns:
- result of the compare between the indexed key and the key portion of the passed cell
-
compareKeyForNextColumn
- Parameters:
nextIndexed
- the key of the next entry in the block index (if any)currentCell
- The Cell we're using to calculate the seek key- Returns:
- result of the compare between the indexed key and the key portion of the passed cell
-
getFilter
Returns the Filter -
getNextKeyHint
Delegate toFilter.getNextCellHint(Cell)
. If no filter, returnnull
.- Throws:
IOException
-
beforeShipped
Description copied from interface:ShipperListener
The action that needs to be performed beforeShipper.shipped()
is performed- Specified by:
beforeShipped
in interfaceShipperListener
- Throws:
IOException
-
createStartKeyFromRow
-
checkColumn
static ScanQueryMatcher.MatchCode checkColumn(ColumnTracker columnTracker, byte[] bytes, int offset, int length, long ttl, byte type, boolean ignoreCount) throws IOException - Throws:
IOException
-