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
Nested ClassesModifier and TypeClassDescriptionstatic enummatch(org.apache.hadoop.hbase.ExtendedCell)return codes. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final ColumnTrackerKeeps track of columns and versionsprotected ExtendedCellRow the query is onprotected final longprotected final longThe oldest timestamp we are interested in, based on TTLprotected final CellComparatorRow comparator for the region this query is forprotected final ExtendedCellKey to seek to in memstore and StoreFiles -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedScanQueryMatcher(ExtendedCell startKey, ScanInfo scanInfo, ColumnTracker columns, long oldestUnexpiredTS, long now) -
Method Summary
Modifier and TypeMethodDescriptionvoidThe action that needs to be performed beforeShipper.shipped()is performed(package private) static ScanQueryMatcher.MatchCodecheckColumn(ColumnTracker columnTracker, byte[] bytes, int offset, int length, long ttl, byte type, boolean ignoreCount) protected final ScanQueryMatcher.MatchCodecheckDeleted(DeleteTracker deletes, ExtendedCell cell) voidMakecurrentRow()return null.intcompareKeyForNextColumn(ExtendedCell nextIndexed, ExtendedCell currentCell) intcompareKeyForNextRow(ExtendedCell nextIndexed, ExtendedCell currentCell) protected static ExtendedCellcreateStartKeyFromRow(byte[] startRow, ScanInfo scanInfo) Returns a cell represent the current rowabstract FilterReturns the Filterabstract ExtendedCellgetNextKeyHint(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 booleanReturns whether there is an null column in the queryprivate static booleanisCellTTLExpired(ExtendedCell cell, long oldestTimestamp, long now) Returns true if the cell is expiredabstract booleanabstract ScanQueryMatcher.MatchCodematch(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 booleanprotected final ScanQueryMatcher.MatchCodepreCheck(ExtendedCell cell) Check before the delete logic.protected abstract voidreset()voidsetToNewRow(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
stopRowor 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:ShipperListenerThe action that needs to be performed beforeShipper.shipped()is performed- Specified by:
beforeShippedin 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
-