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 Summary
Nested 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.DeleteTracker
DeleteTracker.DeleteResult -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intprivate byte[][]private CellComparatorprivate intprivate byte[]private intprivate longprivate intprivate longprivate byteprotected intprivate intprivate longprivate int -
Constructor Summary
ConstructorsConstructorDescriptionNewVersionBehaviorTracker(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 Summary
Modifier and TypeMethodDescriptionvoidadd(ExtendedCell cell) Add 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(ExtendedCell cell, byte type) Checks if the column is present in the list of requested columns by returning the match code instance.checkVersions(ExtendedCell 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.Retrieve the MatchCode for the next row or columnprivate booleanisDeleted(ExtendedCell 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 longprepare(ExtendedCell cell) Reset 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.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.hadoop.hbase.regionserver.querymatcher.ColumnTracker
doneWithColumn
-
Field Details
-
lastCqArray
-
lastCqLength
-
lastCqOffset
-
lastCqTs
-
lastCqMvcc
-
lastCqType
-
columnIndex
-
countCurrentCol
-
maxVersions
-
resultMaxVersions
-
columns
-
minVersions
-
oldestStamp
-
comparator
-
delColMap
-
delFamMap
-
-
Constructor Details
-
Method Details
-
beforeShipped
Description copied from interface:ShipperListenerThe action that needs to be performed beforeShipper.shipped()is performed- Specified by:
beforeShippedin interfaceShipperListener- Throws:
IOException
-
prepare
Reset 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
-
add
Description 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 interfaceDeleteTracker- Parameters:
cell- - the delete cell
-
isDeleted
This method is not idempotent, we will save some info to judge VERSION_MASKED.- Specified by:
isDeletedin interfaceDeleteTracker- 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.
-
isEmpty
Description copied from interface:DeleteTrackerReturns true if there are no current delete, false otherwise- Specified by:
isEmptyin interfaceDeleteTracker
-
update
Description 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 interfaceDeleteTracker
-
checkColumn
Description 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(ExtendedCell, 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 interfaceColumnTracker- 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
public ScanQueryMatcher.MatchCode checkVersions(ExtendedCell 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(ExtendedCell, 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(ExtendedCell, byte)method and perform all the operations in this checkVersions method.- Specified by:
checkVersionsin interfaceColumnTracker- 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
Description copied from interface:ColumnTrackerResets the Matcher- Specified by:
resetin interfaceColumnTracker- Specified by:
resetin interfaceDeleteTracker
-
resetInternal
-
done
Description copied from interface:ColumnTrackerReturnstruewhen done.- Specified by:
donein interfaceColumnTracker
-
getColumnHint
Description 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 interfaceColumnTracker- Returns:
- null, or a ColumnCount that we should seek to
-
getNextRowOrNextColumn
Description copied from interface:ColumnTrackerRetrieve the MatchCode for the next row or column- Specified by:
getNextRowOrNextColumnin interfaceColumnTracker
-
isDone
Description 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 interfaceColumnTracker- Returns:
trueto early out based on timestamp.
-
getCellComparator
Description copied from interface:DeleteTrackerReturn the comparator passed to this delete tracker- Specified by:
getCellComparatorin interfaceDeleteTracker- Returns:
- the cell comparator
-