Class ScanWildcardColumnTracker
java.lang.Object
org.apache.hadoop.hbase.regionserver.querymatcher.ScanWildcardColumnTracker
- All Implemented Interfaces:
ColumnTracker
,ShipperListener
Keeps track of the columns for a scan if they are not explicitly specified
-
Field Summary
Modifier and TypeFieldDescriptionprivate Cell
private final CellComparator
private int
private long
private byte
private final int
private final int
private long
-
Constructor Summary
ConstructorDescriptionScanWildcardColumnTracker
(int minVersion, int maxVersion, long oldestUnexpiredTS, CellComparator comparator) Return maxVersions of every row. -
Method Summary
Modifier and TypeMethodDescriptionvoid
The action that needs to be performed beforeShipper.shipped()
is performedcheckColumn
(Cell cell, byte type) Checks if the column is present in the list of requested columns by returning the match code instance.private ScanQueryMatcher.MatchCode
checkVersion
(byte type, long timestamp) Check whether this version should be retained.checkVersions
(Cell cell, long timestamp, byte type, boolean ignoreCount) Keeps track of the number of versions for the columns asked for.boolean
done()
We can never know a-priori if we are done, so always return false.Used by matcher and scan/get to get a hint of the next column to seek to after checkColumn() returns SKIP.getNextRowOrNextColumn
(Cell cell) Retrieve the MatchCode for the next row or columnboolean
isDone
(long timestamp) Give the tracker a chance to declare it's done based on only the timestamp to allow an early out.private boolean
isExpired
(long timestamp) void
reset()
Resets the Matcherprivate void
private void
private boolean
sameAsPreviousTSAndType
(long timestamp, byte type) private void
setTSAndType
(long timestamp, byte type) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.hadoop.hbase.regionserver.querymatcher.ColumnTracker
doneWithColumn
-
Field Details
-
columnCell
-
currentCount
-
maxVersions
-
minVersions
-
latestTSOfCurrentColumn
-
latestTypeOfCurrentColumn
-
oldestStamp
-
comparator
-
-
Constructor Details
-
ScanWildcardColumnTracker
public ScanWildcardColumnTracker(int minVersion, int maxVersion, long oldestUnexpiredTS, CellComparator comparator) Return maxVersions of every row.- Parameters:
minVersion
- Minimum number of versions to keepmaxVersion
- Maximum number of versions to returnoldestUnexpiredTS
- oldest timestamp that has not expired according to the TTL.comparator
- used to compare the qualifier of cell
-
-
Method Details
-
checkColumn
Checks if the column is present in the list of requested columns by returning the match code instance. It does not check against the number of versions for the columns asked for. To do the version check, one has to callColumnTracker.checkVersions(Cell, long, byte, boolean)
method based on the return type (INCLUDE) of this method. The values that can be returned by this method areScanQueryMatcher.MatchCode.INCLUDE
,ScanQueryMatcher.MatchCode.SEEK_NEXT_COL
andScanQueryMatcher.MatchCode.SEEK_NEXT_ROW
. This receives puts *and* deletes.- Specified by:
checkColumn
in interfaceColumnTracker
- Parameters:
cell
- a cell with the column to match againsttype
- The type of the Cell- Returns:
- The match code instance.
- Throws:
IOException
- in case there is an internal consistency problem caused by a data corruption.
-
checkVersions
public ScanQueryMatcher.MatchCode checkVersions(Cell cell, long timestamp, byte type, boolean ignoreCount) throws IOException Keeps track of the number of versions for the columns asked for. It assumes that the user has already checked if the cell needs to be included by calling theColumnTracker.checkColumn(Cell, byte)
method. The enum values returned by this method areScanQueryMatcher.MatchCode.SKIP
,ScanQueryMatcher.MatchCode.INCLUDE
,ScanQueryMatcher.MatchCode.INCLUDE_AND_SEEK_NEXT_COL
andScanQueryMatcher.MatchCode.INCLUDE_AND_SEEK_NEXT_ROW
. Implementations which include all the columns could just returnScanQueryMatcher.MatchCode.INCLUDE
in theColumnTracker.checkColumn(Cell, byte)
method and perform all the operations in this checkVersions method. This receives puts *and* deletes. Deletes do not count as a version, but rather take the version of the previous put (so eventually all but the last can be reclaimed).- Specified by:
checkVersions
in interfaceColumnTracker
- Parameters:
cell
- a cell with the column to match againsttimestamp
- The timestamp of the cell.type
- the type of the key value (Put/Delete)ignoreCount
- indicates if the KV needs to be excluded while counting (used during compactions. We only count KV's that are older than all the scanners' read points.)- Returns:
- the scan query matcher match code instance
- Throws:
IOException
- in case there is an internal consistency problem caused by a data corruption.
-
resetCell
-
checkVersion
Check whether this version should be retained. There are 4 variables considered: If this version is past max versions -> skip it If this kv has expired or was deleted, check min versions to decide whther to skip it or not. Increase the version counter unless this is a delete -
reset
Description copied from interface:ColumnTracker
Resets the Matcher- Specified by:
reset
in interfaceColumnTracker
-
resetTSAndType
-
setTSAndType
-
sameAsPreviousTSAndType
-
isExpired
-
getColumnHint
Used by matcher and scan/get to get a hint of the next column to seek to after checkColumn() returns SKIP. Returns the next interesting column we want, or NULL there is none (wildcard scanner).- Specified by:
getColumnHint
in interfaceColumnTracker
- Returns:
- The column count.
-
done
We can never know a-priori if we are done, so always return false.- Specified by:
done
in interfaceColumnTracker
-
getNextRowOrNextColumn
Description copied from interface:ColumnTracker
Retrieve the MatchCode for the next row or column- Specified by:
getNextRowOrNextColumn
in interfaceColumnTracker
-
beforeShipped
Description copied from interface:ShipperListener
The action that needs to be performed beforeShipper.shipped()
is performed- Specified by:
beforeShipped
in interfaceShipperListener
-
isDone
Description copied from interface:ColumnTracker
Give the tracker a chance to declare it's done based on only the timestamp to allow an early out.- Specified by:
isDone
in interfaceColumnTracker
- Returns:
true
to early out based on timestamp.
-