@InterfaceAudience.Private public class ExplicitColumnTracker extends Object implements ColumnTracker
ScanQueryMatcher
), we can use this matcher for both scans
and gets. The main difference is 'next' and 'done' collapse for the scan case (since we see all
columns in order), and we only reset between rows.
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
Constructor and Description |
---|
ExplicitColumnTracker(NavigableSet<byte[]> columns,
int minVersions,
int maxVersions,
long oldestUnexpiredTS)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
beforeShipped()
The action that needs to be performed before
Shipper.shipped() is performed |
ScanQueryMatcher.MatchCode |
checkColumn(Cell cell,
byte type)
Checks if the column is present in the list of requested columns by returning the match code
instance.
|
ScanQueryMatcher.MatchCode |
checkVersions(Cell cell,
long timestamp,
byte type,
boolean ignoreCount)
Keeps track of the number of versions for the columns asked for.
|
boolean |
done()
Done when there are no more columns to match against.
|
void |
doneWithColumn(Cell cell)
This method is used to inform the column tracker that we are done with this column.
|
org.apache.hadoop.hbase.regionserver.querymatcher.ColumnCount |
getColumnHint()
Used by matcher and scan/get to get a hint of the next column
to seek to after checkColumn() returns SKIP.
|
ScanQueryMatcher.MatchCode |
getNextRowOrNextColumn(Cell cell)
Retrieve the MatchCode for the next row or column
|
boolean |
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 Matcher
|
public ExplicitColumnTracker(NavigableSet<byte[]> columns, int minVersions, int maxVersions, long oldestUnexpiredTS)
columns
- columns specified user in queryminVersions
- minimum number of versions to keepmaxVersions
- maximum versions to return per columnoldestUnexpiredTS
- the oldest timestamp we are interested in, based on TTLpublic boolean done()
done
in interface ColumnTracker
true
when done.public org.apache.hadoop.hbase.regionserver.querymatcher.ColumnCount getColumnHint()
ColumnTracker
getColumnHint
in interface ColumnTracker
public ScanQueryMatcher.MatchCode checkColumn(Cell cell, byte type)
ColumnTracker.checkVersions(Cell, long, byte, boolean)
method based on the return type (INCLUDE) of this method. The values that can be returned by
this method are ScanQueryMatcher.MatchCode.INCLUDE
, ScanQueryMatcher.MatchCode.SEEK_NEXT_COL
and
ScanQueryMatcher.MatchCode.SEEK_NEXT_ROW
.checkColumn
in interface ColumnTracker
cell
- a cell with the column to match againsttype
- The type of the Cellpublic ScanQueryMatcher.MatchCode checkVersions(Cell cell, long timestamp, byte type, boolean ignoreCount) throws IOException
ColumnTracker
ColumnTracker.checkColumn(Cell, byte)
method. The enum values returned by this method
are ScanQueryMatcher.MatchCode.SKIP
, ScanQueryMatcher.MatchCode.INCLUDE
,
ScanQueryMatcher.MatchCode.INCLUDE_AND_SEEK_NEXT_COL
and ScanQueryMatcher.MatchCode.INCLUDE_AND_SEEK_NEXT_ROW
.
Implementations which include all the columns could just return ScanQueryMatcher.MatchCode.INCLUDE
in
the ColumnTracker.checkColumn(Cell, byte)
method and perform all the operations in this
checkVersions method.checkVersions
in interface ColumnTracker
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.)IOException
- in case there is an internal consistency problem caused by a data
corruption.public void reset()
ColumnTracker
reset
in interface ColumnTracker
public void doneWithColumn(Cell cell)
ColumnTracker
doneWithColumn
in interface ColumnTracker
public ScanQueryMatcher.MatchCode getNextRowOrNextColumn(Cell cell)
ColumnTracker
getNextRowOrNextColumn
in interface ColumnTracker
public boolean isDone(long timestamp)
ColumnTracker
isDone
in interface ColumnTracker
true
to early out based on timestamp.public void beforeShipped() throws IOException
ShipperListener
Shipper.shipped()
is performedbeforeShipped
in interface ShipperListener
IOException
Copyright © 2007–2019 Cloudera. All rights reserved.