@Test public void conservativeGetTimestampToSweepAddsSentinels() { long sweepTimestampHigherThanCommitTimestamp = HIGH_COMMIT_TS + 1; List<CandidateCellForSweeping> candidates = twoCommittedTimestampsForSingleCell(); SweepableCellFilter filter = new SweepableCellFilter( commitTsCache, Sweeper.CONSERVATIVE, sweepTimestampHigherThanCommitTimestamp); List<CellToSweep> cells = filter.getCellsToSweep(candidates).cells(); assertThat(Iterables.getOnlyElement(cells).needsSentinel()).isTrue(); }
public BatchOfCellsToSweep getCellsToSweep(List<CandidateCellForSweeping> candidates) { Map<Long, Long> startToCommitTs = commitTsCache.loadBatch(getAllValidTimestamps(candidates)); ImmutableBatchOfCellsToSweep.Builder builder = ImmutableBatchOfCellsToSweep.builder(); long numCellTsPairsExamined = 0; for (CandidateCellForSweeping candidate : candidates) { getCellToSweep(candidate, startToCommitTs).ifPresent(builder::addCells); numCellTsPairsExamined += candidate.sortedTimestamps().size(); } return builder .numCellTsPairsExamined(numCellTsPairsExamined) .lastCellExamined(candidates.get(candidates.size() - 1).cell()) .build(); }
SweepableCellFilter { public BatchOfCellsToSweep getCellsToSweep(List<CandidateCellForSweeping> candidates) { Map<Long, Long> startToCommitTs = commitTsCache.loadBatch(getAllValidTimestamps(candidates)); ImmutableBatchOfCellsToSweep.Builder builder = ImmutableBatchOfCellsToSweep.builder(); long numCellTsPairsExamined = 0; for (CandidateCellForSweeping candidate : candidates) { getCellToSweep(candidate, startToCommitTs).ifPresent(builder::addCells); numCellTsPairsExamined += candidate.sortedTimestamps().size(); } return builder .numCellTsPairsExamined(numCellTsPairsExamined) .lastCellExamined(candidates.get(candidates.size() - 1).cell()) .build(); } }
SweepableCellFilter { public BatchOfCellsToSweep getCellsToSweep(List<CandidateCellForSweeping> candidates) { Map<Long, Long> startToCommitTs = commitTsCache.loadBatch(getAllValidTimestamps(candidates)); ImmutableBatchOfCellsToSweep.Builder builder = ImmutableBatchOfCellsToSweep.builder(); long numCellTsPairsExamined = 0; for (CandidateCellForSweeping candidate : candidates) { getCellToSweep(candidate, startToCommitTs).ifPresent(builder::addCells); numCellTsPairsExamined += candidate.sortedTimestamps().size(); } return builder .numCellTsPairsExamined(numCellTsPairsExamined) .lastCellExamined(candidates.get(candidates.size() - 1).cell()) .build(); } SweepableCellFilter(CommitTsCache commitTsCache, Sweeper sweeper, long sweepTs); }
SweepableCellFilter { public BatchOfCellsToSweep getCellsToSweep(List<CandidateCellForSweeping> candidates) { Map<Long, Long> startToCommitTs = commitTsCache.loadBatch(getAllValidTimestamps(candidates)); ImmutableBatchOfCellsToSweep.Builder builder = ImmutableBatchOfCellsToSweep.builder(); long numCellTsPairsExamined = 0; for (CandidateCellForSweeping candidate : candidates) { getCellToSweep(candidate, startToCommitTs).ifPresent(builder::addCells); numCellTsPairsExamined += candidate.sortedTimestamps().size(); } return builder .numCellTsPairsExamined(numCellTsPairsExamined) .lastCellExamined(candidates.get(candidates.size() - 1).cell()) .build(); } SweepableCellFilter(CommitTsCache commitTsCache, Sweeper sweeper, long sweepTs); BatchOfCellsToSweep getCellsToSweep(List<CandidateCellForSweeping> candidates); }
SweepableCellFilter { public BatchOfCellsToSweep getCellsToSweep(List<CandidateCellForSweeping> candidates) { Map<Long, Long> startToCommitTs = commitTsCache.loadBatch(getAllValidTimestamps(candidates)); ImmutableBatchOfCellsToSweep.Builder builder = ImmutableBatchOfCellsToSweep.builder(); long numCellTsPairsExamined = 0; for (CandidateCellForSweeping candidate : candidates) { getCellToSweep(candidate, startToCommitTs).ifPresent(builder::addCells); numCellTsPairsExamined += candidate.sortedTimestamps().size(); } return builder .numCellTsPairsExamined(numCellTsPairsExamined) .lastCellExamined(candidates.get(candidates.size() - 1).cell()) .build(); } SweepableCellFilter(CommitTsCache commitTsCache, Sweeper sweeper, long sweepTs); BatchOfCellsToSweep getCellsToSweep(List<CandidateCellForSweeping> candidates);  }