@InterfaceAudience.Private public class ScanWildcardColumnTracker extends Object implements ColumnTracker
Modifier and Type | Field and Description |
---|---|
private byte[] |
columnBuffer |
private int |
columnLength |
private int |
columnOffset |
private int |
currentCount |
private long |
latestTSOfCurrentColumn |
private byte |
latestTypeOfCurrentColumn |
private int |
maxVersions |
private int |
minVersions |
private long |
oldestStamp |
Constructor and Description |
---|
ScanWildcardColumnTracker(int minVersion,
int maxVersion,
long oldestUnexpiredTS)
Return maxVersions of every row.
|
Modifier and Type | Method and Description |
---|---|
ScanQueryMatcher.MatchCode |
checkColumn(byte[] bytes,
int offset,
int length,
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.
|
ScanQueryMatcher.MatchCode |
checkVersions(byte[] bytes,
int offset,
int length,
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.
|
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(byte[] bytes,
int offset,
int qualLength)
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.
|
private boolean |
isExpired(long timestamp) |
void |
reset()
Resets the Matcher
|
private void |
resetBuffer(byte[] bytes,
int offset,
int length) |
private void |
resetTSAndType() |
private boolean |
sameAsPreviousTSAndType(long timestamp,
byte type) |
private void |
setTSAndType(long timestamp,
byte type) |
private byte[] columnBuffer
private int columnOffset
private int columnLength
private int currentCount
private int maxVersions
private int minVersions
private long latestTSOfCurrentColumn
private byte latestTypeOfCurrentColumn
private long oldestStamp
public ScanWildcardColumnTracker(int minVersion, int maxVersion, long oldestUnexpiredTS)
minVersion
- Minimum number of versions to keepmaxVersion
- Maximum number of versions to returnoldestUnexpiredTS
- oldest timestamp that has not expired according
to the TTL.public ScanQueryMatcher.MatchCode checkColumn(byte[] bytes, int offset, int length, byte type) throws IOException
ColumnTracker.checkVersions(byte[], int, int, 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
.
This receives puts *and* deletes.checkColumn
in interface ColumnTracker
type
- The type of the KeyValueIOException
- in case there is an internal consistency problem caused by a data
corruption.public ScanQueryMatcher.MatchCode checkVersions(byte[] bytes, int offset, int length, long timestamp, byte type, boolean ignoreCount) throws IOException
ColumnTracker.checkColumn(byte[], int, int, 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(byte[], int, int, 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).checkVersions
in interface ColumnTracker
timestamp
- The timeToLive to enforce.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.private void resetBuffer(byte[] bytes, int offset, int length)
private ScanQueryMatcher.MatchCode checkVersion(byte type, long timestamp)
public void reset()
ColumnTracker
reset
in interface ColumnTracker
private void resetTSAndType()
private void setTSAndType(long timestamp, byte type)
private boolean sameAsPreviousTSAndType(long timestamp, byte type)
private boolean isExpired(long timestamp)
public ColumnCount getColumnHint()
getColumnHint
in interface ColumnTracker
public boolean done()
done
in interface ColumnTracker
public ScanQueryMatcher.MatchCode getNextRowOrNextColumn(byte[] bytes, int offset, int qualLength)
ColumnTracker
getNextRowOrNextColumn
in interface ColumnTracker
public boolean isDone(long timestamp)
ColumnTracker
isDone
in interface ColumnTracker
true
to early out based on timestamp.Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.