@InterfaceAudience.Private public class NewVersionBehaviorTracker extends Object implements ColumnTracker, DeleteTracker
Modifier and Type | Class and Description |
---|---|
protected class |
NewVersionBehaviorTracker.DeleteVersionsNode
A data structure which contains infos we need that happens before this node's mvcc and after
the previous node's mvcc.
|
DeleteTracker.DeleteResult
Modifier and Type | Field and Description |
---|---|
private int |
columnIndex |
private byte[][] |
columns |
private CellComparator |
comparator |
private int |
countCurrentCol |
protected NavigableMap<Long,NewVersionBehaviorTracker.DeleteVersionsNode> |
delColMap |
protected NavigableMap<Long,NewVersionBehaviorTracker.DeleteVersionsNode> |
delFamMap |
private byte[] |
lastCqArray |
private int |
lastCqLength |
private long |
lastCqMvcc |
private int |
lastCqOffset |
private long |
lastCqTs |
private byte |
lastCqType |
protected int |
maxVersions |
private int |
minVersions |
private long |
oldestStamp |
private int |
resultMaxVersions |
Constructor and Description |
---|
NewVersionBehaviorTracker(NavigableSet<byte[]> columns,
CellComparator comparartor,
int minVersion,
int maxVersion,
int resultMaxVersions,
long oldestUnexpiredTS)
Note maxVersion and minVersion must set according to cf's conf, not user's scan parameter.
|
Modifier and Type | Method and Description |
---|---|
void |
add(Cell cell)
Add the specified cell to the list of deletes to check against for this row operation.
|
void |
beforeShipped()
The action that needs to be performed before
Shipper.shipped() is performed n |
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()
Returns
true when done. |
CellComparator |
getCellComparator()
Return the comparator passed to this delete tracker
|
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 n
|
private boolean |
isColumnQualifierChanged(Cell cell) |
DeleteTracker.DeleteResult |
isDeleted(Cell cell)
This method is not idempotent, we will save some info to judge VERSION_MASKED.
|
boolean |
isDone(long timestamp)
Give the tracker a chance to declare it's done based on only the timestamp to allow an early
out.
|
boolean |
isEmpty()
Returns true if there are no current delete, false otherwise
|
protected long |
prepare(Cell cell)
Reset the map if it is different with the last Cell.
|
void |
reset()
Resets the Matcher
|
protected void |
resetInternal() |
void |
update()
Called at the end of every StoreFile.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
doneWithColumn
private byte[] lastCqArray
private int lastCqLength
private int lastCqOffset
private long lastCqTs
private long lastCqMvcc
private byte lastCqType
private int columnIndex
private int countCurrentCol
protected int maxVersions
private int resultMaxVersions
private byte[][] columns
private int minVersions
private long oldestStamp
private CellComparator comparator
protected NavigableMap<Long,NewVersionBehaviorTracker.DeleteVersionsNode> delColMap
protected NavigableMap<Long,NewVersionBehaviorTracker.DeleteVersionsNode> delFamMap
public NewVersionBehaviorTracker(NavigableSet<byte[]> columns, CellComparator comparartor, int minVersion, int maxVersion, int resultMaxVersions, long oldestUnexpiredTS)
columns
- columns specified user in querycomparartor
- the cell comparatorminVersion
- The minimum number of versions to keep(used when TTL is set).maxVersion
- The maximum number of versions in CF's confresultMaxVersions
- maximum versions to return per column, which may be different from
maxVersionoldestUnexpiredTS
- the oldest timestamp we are interested in, based on TTLpublic void beforeShipped() throws IOException
ShipperListener
Shipper.shipped()
is performed nbeforeShipped
in interface ShipperListener
IOException
protected long prepare(Cell cell)
private boolean isColumnQualifierChanged(Cell cell)
public void add(Cell cell)
DeleteTracker
This is called when a Delete is encountered in a StoreFile.
add
in interface DeleteTracker
cell
- - the delete cellpublic DeleteTracker.DeleteResult isDeleted(Cell cell)
isDeleted
in interface DeleteTracker
cell
- - current cell to check if deleted by a previously seen deletepublic boolean isEmpty()
DeleteTracker
isEmpty
in interface DeleteTracker
public void update()
DeleteTracker
Many optimized implementations of Trackers will require an update at when the end of each StoreFile is reached.
update
in interface DeleteTracker
public ScanQueryMatcher.MatchCode checkColumn(Cell cell, byte type) throws IOException
ColumnTracker
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 CellIOException
- in case there is an internal consistency problem caused by a data
corruption.public 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
reset
in interface DeleteTracker
protected void resetInternal()
public boolean done()
ColumnTracker
true
when done.done
in interface ColumnTracker
public ColumnCount getColumnHint()
ColumnTracker
getColumnHint
in interface ColumnTracker
public ScanQueryMatcher.MatchCode getNextRowOrNextColumn(Cell cell)
ColumnTracker
getNextRowOrNextColumn
in interface ColumnTracker
public boolean isDone(long timestamp)
ColumnTracker
true
to early out based on timestamp.isDone
in interface ColumnTracker
public CellComparator getCellComparator()
DeleteTracker
getCellComparator
in interface DeleteTracker
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.