org.apache.hadoop.hbase.regionserver
Class ScanWildcardColumnTracker

java.lang.Object
  extended by org.apache.hadoop.hbase.regionserver.ScanWildcardColumnTracker
All Implemented Interfaces:
ColumnTracker

public class ScanWildcardColumnTracker
extends Object
implements ColumnTracker

Keeps track of the columns for a scan if they are not explicitly specified


Constructor Summary
ScanWildcardColumnTracker(int minVersion, int maxVersion, long oldestUnexpiredTS)
          Return maxVersions of every row.
 
Method Summary
 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.
 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.
 void reset()
          Resets the Matcher
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScanWildcardColumnTracker

public ScanWildcardColumnTracker(int minVersion,
                                 int maxVersion,
                                 long oldestUnexpiredTS)
Return maxVersions of every row.

Parameters:
minVersion - Minimum number of versions to keep
maxVersion - Maximum number of versions to return
oldestUnexpiredTS - oldest timestamp that has not expired according to the TTL.
Method Detail

checkColumn

public ScanQueryMatcher.MatchCode checkColumn(byte[] bytes,
                                              int offset,
                                              int length,
                                              byte type)
                                       throws IOException
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 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.

Specified by:
checkColumn in interface ColumnTracker
type - The type of the KeyValue
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(byte[] bytes,
                                                int offset,
                                                int length,
                                                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 keyvalue needs to be included by calling the 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).

Specified by:
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.)
Returns:
the scan query matcher match code instance
Throws:
IOException - in case there is an internal consistency problem caused by a data corruption.

reset

public void reset()
Description copied from interface: ColumnTracker
Resets the Matcher

Specified by:
reset in interface ColumnTracker

getColumnHint

public ColumnCount 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).

Specified by:
getColumnHint in interface ColumnTracker
Returns:
The column count.

done

public boolean done()
We can never know a-priori if we are done, so always return false.

Specified by:
done in interface ColumnTracker
Returns:
false

getNextRowOrNextColumn

public ScanQueryMatcher.MatchCode getNextRowOrNextColumn(byte[] bytes,
                                                         int offset,
                                                         int qualLength)
Description copied from interface: ColumnTracker
Retrieve the MatchCode for the next row or column

Specified by:
getNextRowOrNextColumn in interface ColumnTracker

isDone

public boolean isDone(long timestamp)
Description copied from interface: ColumnTracker
Give the tracker a chance to declare it's done based on only the timestamp to allow an early out.

Specified by:
isDone in interface ColumnTracker
Returns:
true to early out based on timestamp.


Copyright © 2013 The Apache Software Foundation. All Rights Reserved.