@Override public void close() throws IOException { keyIterator.close(); }
@Override public void close() throws IOException { MetricInstrumentedStore.runWithMetrics(p, MetricInstrumentedIterator.M_CLOSE, (IOCallable<Void>) () -> { iterator.close(); return null; }); }
@Override public void run() { try { while (keyIterator.hasNext()) { StaticBuffer key = keyIterator.next(); RecordIterator<Entry> entries = keyIterator.getEntries(); if (!keyFilter.test(key)) continue; EntryList entryList = StaticArrayEntryList.ofStaticBuffer(entries, StaticArrayEntry.ENTRY_GETTER); queue.put(new SliceResult(query, key, entryList)); } finished = true; } catch (InterruptedException e) { log.error("Data-pulling thread interrupted while waiting on queue or data", e); } catch (Throwable e) { log.error("Could not load data from storage: {}",e); } finally { try { keyIterator.close(); } catch (IOException e) { log.warn("Could not close storage iterator ", e); } } }
public void testDataSequential() throws Exception { loadData(200000,2); close(); KeyColumnValueStoreManager manager = openStorageManager(); KeyColumnValueStore store = manager.openDatabase(Backend.EDGESTORE_NAME); SliceQuery query = new SliceQuery(BufferUtil.zeroBuffer(8),BufferUtil.oneBuffer(8)); query.setLimit(2); Stopwatch watch = Stopwatch.createStarted(); StoreTransaction txh = manager.beginTransaction(StandardBaseTransactionConfig.of(TimestampProviders.MILLI)); KeyIterator iterator = store.getKeys(query,txh); int numV = 0; while(iterator.hasNext()) { iterator.next(); RecordIterator<Entry> entries = iterator.getEntries(); assertEquals(2, Iterators.size(entries)); numV++; } iterator.close(); txh.commit(); System.out.println("Time taken: " + watch.elapsed(TimeUnit.MILLISECONDS)); System.out.println("Num Vertices: " + numV); store.close(); manager.close(); }