Class NonLazyKeyValueScanner

java.lang.Object
org.apache.hadoop.hbase.regionserver.NonLazyKeyValueScanner
All Implemented Interfaces:
Closeable, AutoCloseable, KeyValueScanner, Shipper
Direct Known Subclasses:
NonReversedNonLazyKeyValueScanner

@Private 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 Details

  • Method Details

    • requestSeek

      public boolean requestSeek(Cell kv, boolean forward, boolean useBloom) throws IOException
      Description copied from interface: KeyValueScanner
      Similar to KeyValueScanner.seek(org.apache.hadoop.hbase.Cell) (or KeyValueScanner.reseek(org.apache.hadoop.hbase.Cell) 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, Cell kv, boolean forward) throws IOException
      Throws:
      IOException
    • shouldUseScanner

      public boolean shouldUseScanner(Scan scan, HStore store, 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
      store - the store we are performing the scan on.
      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()
      Description copied from interface: KeyValueScanner
      Returns true if this is a file scanner. Otherwise a memory scanner is assumed.
      Specified by:
      isFileScanner in interface KeyValueScanner
    • recordBlockSize

      public void recordBlockSize(IntConsumer blockSizeConsumer)
      Description copied from interface: KeyValueScanner
      Record the size of the current block in bytes, passing as an argument to the blockSizeConsumer. Implementations should ensure that blockSizeConsumer is only called once per block.
      Specified by:
      recordBlockSize in interface KeyValueScanner
      Parameters:
      blockSizeConsumer - to be called with block size in bytes, once per block.
    • getFilePath

      public org.apache.hadoop.fs.Path getFilePath()
      Specified by:
      getFilePath in interface KeyValueScanner
      Returns:
      the file path if this is a file scanner, otherwise null.
      See Also:
    • getNextIndexedKey

      Specified by:
      getNextIndexedKey in interface KeyValueScanner
      Returns:
      the next key in the index, usually the first key of next block OR a key that falls between last key of current block and first key of next block.. see HFileWriterImpl#getMidpoint, or null if not known.
    • shipped

      public void shipped() throws IOException
      Description copied from interface: Shipper
      Called after a batch of rows scanned and set to be returned to client. Any in between cleanup can be done here.
      Specified by:
      shipped in interface Shipper
      Throws:
      IOException