private Iterator<Entry<Key,Value>> newIterator(Range r) { synchronized (scanner) { scanner.enableIsolation(); scanner.setBatchSize(batchSize); scanner.setTimeout(timeout, TimeUnit.MILLISECONDS); scanner.setRange(r); scanner.setReadaheadThreshold(readaheadThreshold); setOptions((ScannerOptions) scanner, opts); return scanner.iterator(); // return new FaultyIterator(scanner.iterator()); } }
smi.scanner.setReadaheadThreshold(readaheadThreshold); if (isolated) smi.scanner.enableIsolation(); else smi.scanner.disableIsolation();
private Iterator<Entry<Key,Value>> newIterator(Range r) { synchronized (scanner) { scanner.enableIsolation(); scanner.setBatchSize(batchSize); scanner.setTimeout(timeout, TimeUnit.MILLISECONDS); scanner.setRange(r); scanner.setReadaheadThreshold(readaheadThreshold); setOptions((ScannerOptions) scanner, opts); return scanner.iterator(); // return new FaultyIterator(scanner.iterator()); } }
smi.scanner.setReadaheadThreshold(readaheadThreshold); if (isolated) smi.scanner.enableIsolation(); else smi.scanner.disableIsolation();
@Test public void testBugFix() throws Exception { // test bug fox for ACCUMULO-3977 String table = super.getUniqueNames(1)[0]; Connector conn = getConnector(); conn.tableOperations().create(table); BatchWriter bw = conn.createBatchWriter(table, new BatchWriterConfig()); addDocument(bw, "000A", "dog", "cat", "hamster", "iguana", "the"); addDocument(bw, "000B", "java", "perl", "C++", "pascal", "the"); addDocument(bw, "000C", "chrome", "firefox", "safari", "opera", "the"); addDocument(bw, "000D", "logarithmic", "quadratic", "linear", "exponential", "the"); bw.close(); // its a bug when using rfiles, so flush conn.tableOperations().flush(table, null, null, true); IteratorSetting iterCfg = new IteratorSetting(30, "ayeaye", IntersectingIterator.class.getName()); IntersectingIterator.setColumnFamilies(iterCfg, new Text[] {new Text("the"), new Text("hamster")}); Scanner scanner = conn.createScanner(table, Authorizations.EMPTY); scanner.enableIsolation(); scanner.addScanIterator(iterCfg); for (int i = 0; i < 100; i++) { Iterator<Entry<Key,Value>> iter = scanner.iterator(); Assert.assertTrue(iter.hasNext()); Assert.assertEquals("000A", iter.next().getKey().getColumnQualifierData().toString()); Assert.assertFalse(iter.hasNext()); } }
public static void main(String[] args) throws Exception { ScanOpts opts = new ScanOpts(); opts.parseArgs(Scan.class.getName(), args); Connector connector = opts.getConnector(); Scanner scanner = connector.createScanner(opts.getTableName(), new Authorizations()); if (opts.isolate) { scanner.enableIsolation(); } Random tablet_index_generator = new Random(opts.scan_seed); LoopControl scanning_condition = opts.continuous ? new ContinuousLoopControl() : new IterativeLoopControl(opts.scan_iterations); while (scanning_condition.keepScanning()) { Range range = pickRange(connector.tableOperations(), opts.getTableName(), tablet_index_generator); scanner.setRange(range); if (opts.batch_size > 0) { scanner.setBatchSize(opts.batch_size); } try { consume(scanner); } catch (Exception e) { System.err.println(String.format( "Exception while scanning range %s. Check the state of Accumulo for errors.", range)); throw e; } } }