|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.hadoop.hbase.regionserver.NonLazyKeyValueScanner
org.apache.hadoop.hbase.regionserver.KeyValueHeap
@InterfaceAudience.Private public class KeyValueHeap
Implements a heap merge across any number of KeyValueScanners.
Implements KeyValueScanner itself.
This class is used at the Region level to merge across Stores and at the Store level to merge across the memstore and StoreFiles.
In the Region case, we also need InternalScanner.next(List), so this class also implements InternalScanner. WARNING: As is, if you try to use this as an InternalScanner at the Store level, you will get runtime exceptions.
Constructor Summary | |
---|---|
KeyValueHeap(List<? extends KeyValueScanner> scanners,
KeyValue.KVComparator comparator)
Constructor. |
Method Summary | |
---|---|
void |
close()
Close the KeyValue scanner. |
PriorityQueue<KeyValueScanner> |
getHeap()
|
long |
getSequenceID()
Get the sequence id associated with this KeyValueScanner. |
KeyValue |
next()
Return the next KeyValue in this scanner, iterating the scanner |
boolean |
next(List<KeyValue> result)
Gets the next row of keys from the top-most scanner. |
boolean |
next(List<KeyValue> result,
int limit)
Gets the next row of keys from the top-most scanner. |
boolean |
next(List<KeyValue> result,
int limit,
String metric)
Gets the next row of keys from the top-most scanner. |
boolean |
next(List<KeyValue> result,
String metric)
Grab the next row's worth of values. |
KeyValue |
peek()
Look at the next KeyValue in this scanner, but do not iterate scanner. |
boolean |
requestSeek(KeyValue key,
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 |
reseek(KeyValue seekKey)
This function is identical to the seek(KeyValue) function except
that scanner.seek(seekKey) is changed to scanner.reseek(seekKey). |
boolean |
seek(KeyValue seekKey)
Seeks all scanners at or below the specified seek key. |
Methods inherited from class org.apache.hadoop.hbase.regionserver.NonLazyKeyValueScanner |
---|
doRealSeek, enforceSeek, isFileScanner, realSeekDone, shouldUseScanner |
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 |
---|
enforceSeek, isFileScanner, realSeekDone, shouldUseScanner |
Constructor Detail |
---|
public KeyValueHeap(List<? extends KeyValueScanner> scanners, KeyValue.KVComparator comparator) throws IOException
scanners
- comparator
-
IOException
Method Detail |
---|
public KeyValue peek()
KeyValueScanner
peek
in interface KeyValueScanner
public KeyValue next() throws IOException
KeyValueScanner
next
in interface KeyValueScanner
IOException
public boolean next(List<KeyValue> result, int limit) throws IOException
This method takes care of updating the heap.
This can ONLY be called when you are using Scanners that implement
InternalScanner as well as KeyValueScanner (a StoreScanner
).
next
in interface InternalScanner
result
- limit
-
IOException
- epublic boolean next(List<KeyValue> result, int limit, String metric) throws IOException
This method takes care of updating the heap.
This can ONLY be called when you are using Scanners that implement
InternalScanner as well as KeyValueScanner (a StoreScanner
).
next
in interface InternalScanner
result
- output result listlimit
- limit on row count to getmetric
- the metric name
IOException
- epublic boolean next(List<KeyValue> result) throws IOException
This method takes care of updating the heap.
This can ONLY be called when you are using Scanners that implement
InternalScanner as well as KeyValueScanner (a StoreScanner
).
next
in interface InternalScanner
result
-
IOException
- epublic boolean next(List<KeyValue> result, String metric) throws IOException
InternalScanner
next
in interface InternalScanner
result
- return output arraymetric
- the metric name
IOException
- epublic void close()
KeyValueScanner
close
in interface Closeable
close
in interface InternalScanner
close
in interface KeyValueScanner
public boolean seek(KeyValue seekKey) throws IOException
As individual scanners may run past their ends, those scanners are automatically closed and removed from the heap.
This function (and reseek(KeyValue)
) does not do multi-column
Bloom filter and lazy-seek optimizations. To enable those, call
requestSeek(KeyValue, boolean, boolean)
.
seek
in interface KeyValueScanner
seekKey
- KeyValue to seek at or after
IOException
public boolean reseek(KeyValue seekKey) throws IOException
seek(KeyValue)
function except
that scanner.seek(seekKey) is changed to scanner.reseek(seekKey).
reseek
in interface KeyValueScanner
seekKey
- seek value (should be non-null)
IOException
public boolean requestSeek(KeyValue key, boolean forward, boolean useBloom) throws IOException
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.
requestSeek
in interface KeyValueScanner
requestSeek
in class NonLazyKeyValueScanner
forward
- do a forward-only "reseek" instead of a random-access seekuseBloom
- whether to enable multi-column Bloom filter optimization
IOException
public PriorityQueue<KeyValueScanner> getHeap()
public long getSequenceID()
KeyValueScanner
getSequenceID
in interface KeyValueScanner
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |