Class SegmentScanner
java.lang.Object
org.apache.hadoop.hbase.regionserver.SegmentScanner
- All Implemented Interfaces:
- Closeable,- AutoCloseable,- KeyValueScanner,- Shipper
A scanner of a single memstore segment.
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected booleanprotected Cellprivate Cellprivate longprotected final Segmentprivate booleanprivate CellFields inherited from interface org.apache.hadoop.hbase.regionserver.KeyValueScannerNO_NEXT_INDEXED_KEY
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedSegmentScanner(Segment segment, long readPoint) Scanners are ordered from 0 (oldest) to newest in increasing order.
- 
Method SummaryModifier and TypeMethodDescriptionbooleanbackwardSeek(Cell key) Seek the scanner at or before the row of specified Cell, it firstly tries to seek the scanner at or after the specified Cell, return if peek KeyValue of scanner has the same row with specified Cell, otherwise seek the scanner at the first Cell of the row which is the previous row of specified KeyValuevoidclose()Close the KeyValue scanner.voidThis function should be never called on scanners that always do real seek operations (i.e.org.apache.hadoop.fs.Pathprivate CellgetHighest(Cell first, Cell second) Private internal method that returns the higher of the two key values, or null if they are both nullgetIterator(Cell cell) private SegmentPrivate MethodsbooleanReturns true if this is a file scanner.next()Return the next Cell in this scanner, iterating the scannerpeek()Look at the next Cell in this scanner, but do not iterate the scannerbooleanThis scanner is working solely on the in-memory MemStore and doesn't work on store files, MutableCellSetSegmentScanner always does the seek, therefore always returning true.voidrecordBlockSize(IntConsumer blockSizeConsumer) Record the size of the current block in bytes, passing as an argument to the blockSizeConsumer.booleanrequestSeek(Cell c, boolean forward, boolean useBloom) Similar toKeyValueScanner.seek(org.apache.hadoop.hbase.Cell)(orKeyValueScanner.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.booleanReseek the scanner at or after the specified KeyValue.booleanSeek the scanner at or after the specified Cell.booleanSeek the scanner at the first KeyValue of last rowbooleanseekToPreviousRow(Cell cell) Seek the scanner at the first Cell of the row which is the previous row of specified keyvoidshipped()Called after a batch of rows scanned (RPC) and set to be returned to client.booleanshouldUseScanner(Scan scan, HStore store, long oldestUnexpiredTS) This functionality should be resolved in the higher level which is MemStoreScanner, currently returns true as default.toString()protected voidPrivate internal method for iterating over the segment, skipping the cells with irrelevant MVCCMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.hadoop.hbase.regionserver.KeyValueScannergetScannerOrder
- 
Field Details- 
segment
- 
readPoint
- 
iter
- 
current
- 
stopSkippingKVsIfNextRow
- 
stopSkippingKVsRow
- 
last
- 
closed
 
- 
- 
Constructor Details- 
SegmentScannerScanners are ordered from 0 (oldest) to newest in increasing order.
 
- 
- 
Method Details- 
peekLook at the next Cell in this scanner, but do not iterate the scanner- Specified by:
- peekin interface- KeyValueScanner
- Returns:
- the currently observed Cell
 
- 
nextReturn the next Cell in this scanner, iterating the scanner- Specified by:
- nextin interface- KeyValueScanner
- Returns:
- the next Cell or null if end of scanner
- Throws:
- IOException
 
- 
seekSeek the scanner at or after the specified Cell.- Specified by:
- seekin interface- KeyValueScanner
- Parameters:
- cell- seek value
- Returns:
- true if scanner has values left, false if end of scanner
- Throws:
- IOException
 
- 
getIterator
- 
reseekReseek the scanner at or after the specified KeyValue. This method is guaranteed to seek at or after the required key only if the key comes after the current position of the scanner. Should not be used to seek to a key which may come before the current position.- Specified by:
- reseekin interface- KeyValueScanner
- Parameters:
- cell- seek value (should be non-null)
- Returns:
- true if scanner has values left, false if end of scanner
- Throws:
- IOException
 
- 
backwardSeekSeek the scanner at or before the row of specified Cell, it firstly tries to seek the scanner at or after the specified Cell, return if peek KeyValue of scanner has the same row with specified Cell, otherwise seek the scanner at the first Cell of the row which is the previous row of specified KeyValue- Specified by:
- backwardSeekin interface- KeyValueScanner
- Parameters:
- key- seek Cell
- Returns:
- true if the scanner is at the valid KeyValue, false if such Cell does not exist
- Throws:
- IOException
 
- 
seekToPreviousRowSeek the scanner at the first Cell of the row which is the previous row of specified key- Specified by:
- seekToPreviousRowin interface- KeyValueScanner
- Parameters:
- cell- seek value
- Returns:
- true if the scanner at the first valid Cell of previous row, false if not existing such Cell
- Throws:
- IOException
 
- 
seekToLastRowSeek the scanner at the first KeyValue of last row- Specified by:
- seekToLastRowin interface- KeyValueScanner
- Returns:
- true if scanner has values left, false if the underlying data is empty
- Throws:
- IOException
 
- 
closeClose the KeyValue scanner.- Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- Closeable
- Specified by:
- closein interface- KeyValueScanner
 
- 
shouldUseScannerThis functionality should be resolved in the higher level which is MemStoreScanner, currently returns true as default. Doesn't throw IllegalStateException in order not to change the signature of the overridden method- Specified by:
- shouldUseScannerin 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
 
- 
requestSeekDescription copied from interface:KeyValueScannerSimilar toKeyValueScanner.seek(org.apache.hadoop.hbase.Cell)(orKeyValueScanner.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:
- requestSeekin 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
 
- 
realSeekDoneThis scanner is working solely on the in-memory MemStore and doesn't work on store files, MutableCellSetSegmentScanner always does the seek, therefore always returning true.- Specified by:
- realSeekDonein interface- KeyValueScanner
 
- 
enforceSeekThis function should be never called on scanners that always do real seek operations (i.e. most of the scanners and also this one). The easiest way to achieve this is to callrealSeekDone()first.- Specified by:
- enforceSeekin interface- KeyValueScanner
- Throws:
- IOException
 
- 
isFileScannerReturns true if this is a file scanner. Otherwise a memory scanner is assumed.- Specified by:
- isFileScannerin interface- KeyValueScanner
 
- 
recordBlockSizeDescription copied from interface:KeyValueScannerRecord 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:
- recordBlockSizein interface- KeyValueScanner
- Parameters:
- blockSizeConsumer- to be called with block size in bytes, once per block.
 
- 
getFilePath- Specified by:
- getFilePathin interface- KeyValueScanner
- Returns:
- the file path if this is a file scanner, otherwise null.
- See Also:
 
- 
getNextIndexedKey- Specified by:
- getNextIndexedKeyin interface- KeyValueScanner
- Returns:
- the next key in the index (the key to seek to the next block) if known, or null otherwise Not relevant for in-memory scanner
 
- 
shippedCalled after a batch of rows scanned (RPC) and set to be returned to client. Any in between cleanup can be done here. Nothing to be done for MutableCellSetSegmentScanner.- Specified by:
- shippedin interface- Shipper
- Throws:
- IOException
 
- 
toString
- 
getSegmentPrivate Methods
- 
updateCurrentPrivate internal method for iterating over the segment, skipping the cells with irrelevant MVCC
- 
getHighestPrivate internal method that returns the higher of the two key values, or null if they are both null
 
-