@Override public synchronized boolean seek(KeyValue key) throws IOException { if (this.heap == null) { List<KeyValueScanner> scanners = getScannersNoCompaction(); heap = new KeyValueHeap(scanners, store.comparator); } return this.heap.seek(key); }
private void resetScannerStack(KeyValue lastTopKey) throws IOException { if (heap != null) { throw new RuntimeException("StoreScanner.reseek run on an existing heap!"); } /* When we have the scan object, should we not pass it to getScanners() * to get a limited set of scanners? We did so in the constructor and we * could have done it now by storing the scan object from the constructor */ List<KeyValueScanner> scanners = getScannersNoCompaction(); for(KeyValueScanner scanner : scanners) { scanner.seek(lastTopKey); } // Combine all seeked scanners with a heap heap = new KeyValueHeap(scanners, store.comparator); // Reset the state of the Query Matcher and set to top row. // Only reset and call setRow if the row changes; avoids confusing the // query matcher if scanning intra-row. KeyValue kv = heap.peek(); if (kv == null) { kv = lastTopKey; } byte[] row = kv.getBuffer(); int offset = kv.getRowOffset(); short length = kv.getRowLength(); if ((matcher.row == null) || !Bytes.equals(row, offset, length, matcher.row, matcher.rowOffset, matcher.rowLength)) { matcher.reset(); matcher.setRow(row, offset, length); } }
protected void resetScannerStack(Cell lastTopKey) throws IOException { if (heap != null) { throw new RuntimeException("StoreScanner.reseek run on an existing heap!"); } /* When we have the scan object, should we not pass it to getScanners() * to get a limited set of scanners? We did so in the constructor and we * could have done it now by storing the scan object from the constructor */ List<KeyValueScanner> scanners = getScannersNoCompaction(); // Seek all scanners to the initial key seekScanners(scanners, lastTopKey, false, parallelSeekEnabled); // Combine all seeked scanners with a heap resetKVHeap(scanners, store.getComparator()); // Reset the state of the Query Matcher and set to top row. // Only reset and call setRow if the row changes; avoids confusing the // query matcher if scanning intra-row. Cell kv = heap.peek(); if (kv == null) { kv = lastTopKey; } byte[] row = kv.getRowArray(); int offset = kv.getRowOffset(); short length = kv.getRowLength(); if ((matcher.row == null) || !Bytes.equals(row, offset, length, matcher.row, matcher.rowOffset, matcher.rowLength)) { this.countPerRow = 0; matcher.reset(); matcher.setRow(row, offset, length); } }
List<KeyValueScanner> scanners = getScannersNoCompaction();
List<KeyValueScanner> scanners = getScannersNoCompaction();