Source:
<code>private RegionScanner getLocalScanner() throws IOException { if(minTimestamp!= 0) { Scan incrScan = new Scan(scan); incrScan.setTimeRange(minTimestamp, scan.getTimeRange().getMax()); incrScan.setRaw(true); incrScan.setMaxVersions(); incrScan.getFamilyMap().clear(); incrScan.setCacheBlocks(false); for (byte[] family : scan.getFamilyMap().keySet()) { incrScan.addFamily(family); } if(nextStartKey != null) { incrScan.setStartRow(nextStartKey); } List<KeyRange> keys = new ArrayList<>(); try(RegionScanner scanner = region.getScanner(incrScan)) { List<Cell> row = new ArrayList<>(); int rowCount = 0; do { hasMoreIncr = scanner.nextRaw(row); if (!row.isEmpty()) { keys.add(PVarbinary.INSTANCE.getKeyRange(CellUtil.cloneRow(row.get(0)))); rowCount++; } row.clear(); } while (hasMoreIncr && rowCount < pageSizeInRows); } if (!hasMoreIncr && keys.isEmpty()) { return null; } if (!keys.isEmpty()) { nextStartKey = ByteUtil.calculateTheClosestNextRowKeyForPrefix(keys.get(keys.size() - 1).getLowerRange()); } try { ScanRanges scanRanges = ScanRanges.createPointLookup(keys); scanRanges.initializeScan(incrScan); SkipScanFilter skipScanFilter = scanRanges.getSkipScanFilter(); <START> incrScan.setFilter(new SkipScanFilter(skipScanFilter, true)); <END> incrScan.setTimeRange(0, scan.getTimeRange().getMax()); scan.setTimeRange(0, scan.getTimeRange().getMax()); return region.getScanner(incrScan); } catch (IndexOutOfBoundsException ex) { if(keys.size()!=0) { throw ex; } } } return innerScanner; }</code><technical_language>if a Filter scan (such if rebuilding a view index). I _think_ OK, generated key list for SkipScanFilter pre-existing view filter incrScan original rebuild Scan, test that</technical_language>

Target:
private RegionScanner getLocalScanner() throws IOException { if(minTimestamp!= 0) { Scan incrScan = new Scan(scan); incrScan.setTimeRange(minTimestamp, scan.getTimeRange().getMax()); incrScan.setRaw(true); incrScan.setMaxVersions(); incrScan.getFamilyMap().clear(); incrScan.setCacheBlocks(false); for (byte[] family : scan.getFamilyMap().keySet()) { incrScan.addFamily(family); } if (scan.getFilter() instanceof FirstKeyOnlyFilter) { incrScan.setFilter(null); } else if (scan.getFilter() != null) { incrScan.setFilter(new AllVersionsIndexRebuildFilter(scan.getFilter())); } if(nextStartKey != null) { incrScan.setStartRow(nextStartKey); } List<KeyRange> keys = new ArrayList<>(); try(RegionScanner scanner = region.getScanner(incrScan)) { List<Cell> row = new ArrayList<>(); int rowCount = 0; do { hasMoreIncr = scanner.nextRaw(row); if (!row.isEmpty()) { keys.add(PVarbinary.INSTANCE.getKeyRange(CellUtil.cloneRow(row.get(0)))); rowCount++; } row.clear(); } while (hasMoreIncr && rowCount < pageSizeInRows); } if (!hasMoreIncr && keys.isEmpty()) { return null; } if (keys.isEmpty()) { return innerScanner; } nextStartKey = ByteUtil.calculateTheClosestNextRowKeyForPrefix(keys.get(keys.size() - 1).getLowerRange()); ScanRanges scanRanges = ScanRanges.createPointLookup(keys); scanRanges.initializeScan(incrScan); SkipScanFilter skipScanFilter = scanRanges.getSkipScanFilter(); incrScan.setFilter(new SkipScanFilter(skipScanFilter, true)); incrScan.setTimeRange(0, scan.getTimeRange().getMax()); scan.setTimeRange(0, scan.getTimeRange().getMax()); return region.getScanner(incrScan); } return innerScanner; }