Interface ColumnTracker

All Superinterfaces:
ShipperListener
All Known Implementing Classes:
ExplicitColumnTracker, NewVersionBehaviorTracker, ScanWildcardColumnTracker, VisibilityNewVersionBehaivorTracker

@Private public interface ColumnTracker extends ShipperListener
Implementing classes of this interface will be used for the tracking and enforcement of columns and numbers of versions and timeToLive during the course of a Get or Scan operation.

Currently there are two different types of Store/Family-level queries.

This class is utilized by ScanQueryMatcher mainly through two methods:

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

  • Method Summary

    Modifier and Type
    Method
    Description
    checkColumn(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.
    boolean
    Returns true when done.
    default void
    This method is used to inform the column tracker that we are done with this column.
    Used 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 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
    Resets the Matcher

    Methods inherited from interface org.apache.hadoop.hbase.regionserver.ShipperListener

    beforeShipped
  • Method Details

    • checkColumn

      Checks 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 call 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.
      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.
    • checkVersions

      ScanQueryMatcher.MatchCode checkVersions(Cell cell, long timestamp, byte type, boolean ignoreCount) throws IOException
      Keeps 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 the 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 checkColumn(Cell, byte) method and perform all the operations in this checkVersions method.
      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.
    • reset

      void reset()
      Resets the Matcher
    • done

      boolean done()
      Returns true when done.
    • getColumnHint

      Used 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.
      Returns:
      null, or a ColumnCount that we should seek to
    • getNextRowOrNextColumn

      Retrieve the MatchCode for the next row or column
    • isDone

      boolean isDone(long timestamp)
      Give the tracker a chance to declare it's done based on only the timestamp to allow an early out.
      Returns:
      true to early out based on timestamp.
    • doneWithColumn

      default void doneWithColumn(Cell cell)
      This method is used to inform the column tracker that we are done with this column. We may get this information from external filters or timestamp range and we then need to indicate this information to tracker. It is currently implemented for ExplicitColumnTracker.