org.apache.hadoop.hbase.regionserver
Class NonLazyKeyValueScanner

java.lang.Object
  extended by org.apache.hadoop.hbase.regionserver.NonLazyKeyValueScanner
All Implemented Interfaces:
KeyValueScanner
Direct Known Subclasses:
CollectionBackedScanner, KeyValueHeap, MemStore.MemStoreScanner, StoreScanner

public abstract class NonLazyKeyValueScanner
extends Object
implements KeyValueScanner

A "non-lazy" scanner which always does a real seek operation. Most scanners are inherited from this class.


Constructor Summary
NonLazyKeyValueScanner()
           
 
Method Summary
static boolean doRealSeek(KeyValueScanner scanner, KeyValue kv, boolean forward)
           
 void enforceSeek()
          Does the real seek operation in case it was skipped by seekToRowCol(KeyValue, boolean) (TODO: Whats this?).
 boolean isFileScanner()
           
 boolean realSeekDone()
          We optimize our store scanners by checking the most recent store file first, so we sometimes pretend we have done a seek but delay it until the store scanner bubbles up to the top of the key-value heap.
 boolean requestSeek(KeyValue kv, boolean forward, boolean useBloom)
          Similar to KeyValueScanner.seek(org.apache.hadoop.hbase.KeyValue) (or KeyValueScanner.reseek(org.apache.hadoop.hbase.KeyValue) if forward is true) but only does a seek operation after checking that it is really necessary for the row/column combination specified by the kv parameter.
 boolean shouldUseScanner(Scan scan, SortedSet<byte[]> columns, long oldestUnexpiredTS)
          Allows to filter out scanners (both StoreFile and memstore) that we don't want to use based on criteria such as Bloom filters and timestamp ranges.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.hadoop.hbase.regionserver.KeyValueScanner
close, getSequenceID, next, peek, reseek, seek
 

Constructor Detail

NonLazyKeyValueScanner

public NonLazyKeyValueScanner()
Method Detail

requestSeek

public boolean requestSeek(KeyValue kv,
                           boolean forward,
                           boolean useBloom)
                    throws IOException
Description copied from interface: KeyValueScanner
Similar to KeyValueScanner.seek(org.apache.hadoop.hbase.KeyValue) (or KeyValueScanner.reseek(org.apache.hadoop.hbase.KeyValue) if forward is true) but only does a seek operation after checking that it is really necessary for the row/column combination specified by the kv parameter. This function was added to avoid unnecessary disk seeks by checking row-column Bloom filters before a seek on multi-column get/scan queries, and to optimize by looking up more recent files first.

Specified by:
requestSeek in interface KeyValueScanner
forward - do a forward-only "reseek" instead of a random-access seek
useBloom - whether to enable multi-column Bloom filter optimization
Throws:
IOException

realSeekDone

public boolean realSeekDone()
Description copied from interface: KeyValueScanner
We optimize our store scanners by checking the most recent store file first, so we sometimes pretend we have done a seek but delay it until the store scanner bubbles up to the top of the key-value heap. This method is then used to ensure the top store file scanner has done a seek operation.

Specified by:
realSeekDone in interface KeyValueScanner

enforceSeek

public void enforceSeek()
                 throws IOException
Description copied from interface: KeyValueScanner
Does the real seek operation in case it was skipped by seekToRowCol(KeyValue, boolean) (TODO: Whats this?). Note that this function should be never called on scanners that always do real seek operations (i.e. most of the scanners). The easiest way to achieve this is to call KeyValueScanner.realSeekDone() first.

Specified by:
enforceSeek in interface KeyValueScanner
Throws:
IOException

doRealSeek

public static boolean doRealSeek(KeyValueScanner scanner,
                                 KeyValue kv,
                                 boolean forward)
                          throws IOException
Throws:
IOException

shouldUseScanner

public boolean shouldUseScanner(Scan scan,
                                SortedSet<byte[]> columns,
                                long oldestUnexpiredTS)
Description copied from interface: KeyValueScanner
Allows to filter out scanners (both StoreFile and memstore) that we don't want to use based on criteria such as Bloom filters and timestamp ranges.

Specified by:
shouldUseScanner in interface KeyValueScanner
Parameters:
scan - the scan that we are selecting scanners for
columns - the set of columns in the current column family, or null if not specified by the scan
oldestUnexpiredTS - the oldest timestamp we are interested in for this query, based on TTL
Returns:
true if the scanner should be included in the query

isFileScanner

public boolean isFileScanner()
Specified by:
isFileScanner in interface KeyValueScanner
Returns:
true if this is a file scanner. Otherwise a memory scanner is assumed.


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