Interface ColumnTracker
- All Superinterfaces:
ShipperListener
- All Known Implementing Classes:
ExplicitColumnTracker
,NewVersionBehaviorTracker
,ScanWildcardColumnTracker
,VisibilityNewVersionBehaivorTracker
Implementing classes of this interface will be used for the tracking and enforcement of columns
and numbers of versions and timeToLive during the course of a Get or Scan operation.
Currently there are two different types of Store/Family-level queries.
ExplicitColumnTracker
is used when the query specifies one or more column qualifiers to return in the family.ScanWildcardColumnTracker
is used when no columns are explicitly specified.
This class is utilized by ScanQueryMatcher
mainly through two methods:
checkColumn(org.apache.hadoop.hbase.Cell, byte)
is called when a Put satisfies all other conditions of the query.getNextRowOrNextColumn(org.apache.hadoop.hbase.Cell)
is called whenever ScanQueryMatcher believes that the current column should be skipped (by timestamp, filter etc.)
These two methods returns a
ScanQueryMatcher.MatchCode
to define
what action should be taken.
This class is NOT thread-safe as queries are never multi-threaded
-
Method Summary
Modifier and TypeMethodDescriptioncheckColumn
(Cell cell, byte type) Checks if the column is present in the list of requested columns by returning the match code instance.checkVersions
(Cell cell, long timestamp, byte type, boolean ignoreCount) Keeps track of the number of versions for the columns asked for.boolean
done()
Returnstrue
when done.default void
doneWithColumn
(Cell cell) This method is used to inform the column tracker that we are done with this column.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.void
reset()
Resets the MatcherMethods inherited from interface org.apache.hadoop.hbase.regionserver.ShipperListener
beforeShipped
-
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 callcheckVersions(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
.- 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
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 thecheckColumn(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 thecheckColumn(Cell, byte)
method and perform all the operations in this checkVersions method.- 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.
-
reset
void reset()Resets the Matcher -
done
boolean done()Returnstrue
when done. -
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). Implementations aren't required to return anything useful unless the most recent call was to checkColumn() and the return code was SKIP. This is pretty implementation detail-y, but optimizations are like that.- Returns:
- null, or a ColumnCount that we should seek to
-
getNextRowOrNextColumn
Retrieve the MatchCode for the next row or column -
isDone
Give the tracker a chance to declare it's done based on only the timestamp to allow an early out.- Returns:
true
to early out based on timestamp.
-
doneWithColumn
This method is used to inform the column tracker that we are done with this column. We may get this information from external filters or timestamp range and we then need to indicate this information to tracker. It is currently implemented for ExplicitColumnTracker.
-