/** * Ensure we get expected exception when we try to return null from a preFlush call. * @throws IOException We expect it to throw {@link CoprocessorException} */ @Test (expected = CoprocessorException.class) public void testPreFlushReturningNull() throws IOException { RegionCoprocessorHost rch = getRegionCoprocessorHost(); rch.preFlush(null, null, null); }
/** * Creates the scanner for flushing snapshot. Also calls coprocessors. * @param snapshotScanners * @param smallestReadPoint * @return The scanner; null if coprocessor is canceling the flush. */ protected final InternalScanner createScanner(List<KeyValueScanner> snapshotScanners, long smallestReadPoint, FlushLifeCycleTracker tracker) throws IOException { ScanInfo scanInfo; if (store.getCoprocessorHost() != null) { scanInfo = store.getCoprocessorHost().preFlushScannerOpen(store, tracker); } else { scanInfo = store.getScanInfo(); } InternalScanner scanner = new StoreScanner(store, scanInfo, snapshotScanners, ScanType.COMPACT_RETAIN_DELETES, smallestReadPoint, HConstants.OLDEST_TIMESTAMP); assert scanner != null; if (store.getCoprocessorHost() != null) { try { return store.getCoprocessorHost().preFlush(store, scanner, tracker); } catch (IOException ioe) { scanner.close(); throw ioe; } } return scanner; }
/** * Creates the scanner for flushing snapshot. Also calls coprocessors. * @param snapshotScanner * @param smallestReadPoint * @return The scanner; null if coprocessor is canceling the flush. */ protected InternalScanner createScanner(KeyValueScanner snapshotScanner, long smallestReadPoint) throws IOException { InternalScanner scanner = null; if (store.getCoprocessorHost() != null) { scanner = store.getCoprocessorHost().preFlushScannerOpen(store, snapshotScanner); } if (scanner == null) { Scan scan = new Scan(); scan.setMaxVersions(store.getScanInfo().getMaxVersions()); scanner = new StoreScanner(store, store.getScanInfo(), scan, Collections.singletonList(snapshotScanner), ScanType.COMPACT_RETAIN_DELETES, smallestReadPoint, HConstants.OLDEST_TIMESTAMP); } assert scanner != null; if (store.getCoprocessorHost() != null) { try { return store.getCoprocessorHost().preFlush(store, scanner); } catch (IOException ioe) { scanner.close(); throw ioe; } } return scanner; }
coprocessorHost.preFlush(tracker);
getHRegion().getCoprocessorHost().preFlush(this, scanner);
/** * Ensure we get expected exception when we try to return null from a preFlush call. * @throws IOException We expect it to throw {@link CoprocessorException} */ @Test (expected = CoprocessorException.class) public void testPreFlushReturningNull() throws IOException { RegionCoprocessorHost rch = getRegionCoprocessorHost(); rch.preFlush(null, null, null); }
coprocessorHost.preFlush();
coprocessorHost.preFlush();