HBASE-14826 Small improvement in KVHeap seek() API (Ram)

This commit is contained in:
ramkrishna 2015-11-24 10:16:35 +05:30
parent daba867734
commit afc5439be5
1 changed files with 6 additions and 4 deletions

View File

@ -297,11 +297,9 @@ public class KeyValueHeap extends NonReversedNonLazyKeyValueScanner
if (current == null) {
return false;
}
heap.add(current);
current = null;
KeyValueScanner scanner;
while ((scanner = heap.poll()) != null) {
KeyValueScanner scanner = current;
while (scanner != null) {
Cell topKey = scanner.peek();
if (comparator.getComparator().compare(seekKey, topKey) <= 0) {
// Top KeyValue is at-or-after Seek KeyValue. We only know that all
@ -329,6 +327,10 @@ public class KeyValueHeap extends NonReversedNonLazyKeyValueScanner
} else {
heap.add(scanner);
}
scanner = heap.poll();
if (scanner == null) {
current = null;
}
}
// Heap is returning empty, scanner is done