Class NewVersionBehaviorTracker
java.lang.Object
org.apache.hadoop.hbase.regionserver.querymatcher.NewVersionBehaviorTracker
- All Implemented Interfaces:
- ColumnTracker,- DeleteTracker,- ShipperListener
- Direct Known Subclasses:
- VisibilityNewVersionBehaivorTracker
@Private
public class NewVersionBehaviorTracker
extends Object
implements ColumnTracker, DeleteTracker
A tracker both implementing ColumnTracker and DeleteTracker, used for mvcc-sensitive scanning. We
 should make sure in one QueryMatcher the ColumnTracker and DeleteTracker is the same instance.
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionprotected classA data structure which contains infos we need that happens before this node's mvcc and after the previous node's mvcc.Nested classes/interfaces inherited from interface org.apache.hadoop.hbase.regionserver.querymatcher.DeleteTrackerDeleteTracker.DeleteResult
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprivate intprivate byte[][]private CellComparatorprivate intprivate byte[]private intprivate longprivate intprivate longprivate byteprotected intprivate intprivate longprivate int
- 
Constructor SummaryConstructorsConstructorDescriptionNewVersionBehaviorTracker(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.
- 
Method SummaryModifier and TypeMethodDescriptionvoidAdd the specified cell to the list of deletes to check against for this row operation.voidThe 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.checkVersions(Cell cell, long timestamp, byte type, boolean ignoreCount) Keeps track of the number of versions for the columns asked for.booleandone()Returnstruewhen done.Return the comparator passed to this delete trackerUsed 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 columnprivate booleanisColumnQualifierChanged(Cell cell) This method is not idempotent, we will save some info to judge VERSION_MASKED.booleanisDone(long timestamp) Give the tracker a chance to declare it's done based on only the timestamp to allow an early out.booleanisEmpty()Returns true if there are no current delete, false otherwiseprotected longReset the map if it is different with the last Cell.voidreset()Resets the Matcherprotected voidvoidupdate()Called at the end of every StoreFile.Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.hadoop.hbase.regionserver.querymatcher.ColumnTrackerdoneWithColumn
- 
Field Details- 
lastCqArray
- 
lastCqLength
- 
lastCqOffset
- 
lastCqTs
- 
lastCqMvcc
- 
lastCqType
- 
columnIndex
- 
countCurrentCol
- 
maxVersions
- 
resultMaxVersions
- 
columns
- 
minVersions
- 
oldestStamp
- 
comparator
- 
delColMap
- 
delFamMap
 
- 
- 
Constructor Details
- 
Method Details- 
beforeShippedDescription copied from interface:ShipperListenerThe action that needs to be performed beforeShipper.shipped()is performed- Specified by:
- beforeShippedin interface- ShipperListener
- Throws:
- IOException
 
- 
prepareReset the map if it is different with the last Cell. Save the cq array/offset/length for next Cell.- Returns:
- If this put has duplicate ts with last cell, return the mvcc of last cell. Else return MAX_VALUE.
 
- 
isColumnQualifierChanged
- 
addDescription copied from interface:DeleteTrackerAdd the specified cell to the list of deletes to check against for this row operation.This is called when a Delete is encountered in a StoreFile. - Specified by:
- addin interface- DeleteTracker
- Parameters:
- cell- - the delete cell
 
- 
isDeletedThis method is not idempotent, we will save some info to judge VERSION_MASKED.- Specified by:
- isDeletedin interface- DeleteTracker
- Parameters:
- cell- - current cell to check if deleted by a previously seen delete
- Returns:
- We don't distinguish DeleteColumn and DeleteFamily. We only return code for column.
 
- 
isEmptyDescription copied from interface:DeleteTrackerReturns true if there are no current delete, false otherwise- Specified by:
- isEmptyin interface- DeleteTracker
 
- 
updateDescription copied from interface:DeleteTrackerCalled at the end of every StoreFile.Many optimized implementations of Trackers will require an update at when the end of each StoreFile is reached. - Specified by:
- updatein interface- DeleteTracker
 
- 
checkColumnDescription copied from interface:ColumnTrackerChecks 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_COLandScanQueryMatcher.MatchCode.SEEK_NEXT_ROW.- Specified by:
- checkColumnin interface- ColumnTracker
- Parameters:
- cell- a cell with the column to match against
- type- 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.
 
- 
checkVersionspublic ScanQueryMatcher.MatchCode checkVersions(Cell cell, long timestamp, byte type, boolean ignoreCount) throws IOException Description copied from interface:ColumnTrackerKeeps 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_COLandScanQueryMatcher.MatchCode.INCLUDE_AND_SEEK_NEXT_ROW. Implementations which include all the columns could just returnScanQueryMatcher.MatchCode.INCLUDEin theColumnTracker.checkColumn(Cell, byte)method and perform all the operations in this checkVersions method.- Specified by:
- checkVersionsin interface- ColumnTracker
- Parameters:
- cell- a cell with the column to match against
- timestamp- 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.
 
- 
resetDescription copied from interface:ColumnTrackerResets the Matcher- Specified by:
- resetin interface- ColumnTracker
- Specified by:
- resetin interface- DeleteTracker
 
- 
resetInternal
- 
doneDescription copied from interface:ColumnTrackerReturnstruewhen done.- Specified by:
- donein interface- ColumnTracker
 
- 
getColumnHintDescription copied from interface:ColumnTrackerUsed 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.- Specified by:
- getColumnHintin interface- ColumnTracker
- Returns:
- null, or a ColumnCount that we should seek to
 
- 
getNextRowOrNextColumnDescription copied from interface:ColumnTrackerRetrieve the MatchCode for the next row or column- Specified by:
- getNextRowOrNextColumnin interface- ColumnTracker
 
- 
isDoneDescription copied from interface:ColumnTrackerGive the tracker a chance to declare it's done based on only the timestamp to allow an early out.- Specified by:
- isDonein interface- ColumnTracker
- Returns:
- trueto early out based on timestamp.
 
- 
getCellComparatorDescription copied from interface:DeleteTrackerReturn the comparator passed to this delete tracker- Specified by:
- getCellComparatorin interface- DeleteTracker
- Returns:
- the cell comparator
 
 
-