@Test public void thorough_getTimestampsToSweep_oneTransaction_emptyValue_returnsIt() { List<CandidateCellForSweeping> candidate = ImmutableList.of( ImmutableCandidateCellForSweeping.builder() .cell(SINGLE_CELL) .sortedTimestamps(ImmutableList.of(LOW_START_TS)) .isLatestValueEmpty(true) .build()); when(mockTransactionService.get(anyCollection())) .thenReturn(ImmutableMap.of(LOW_START_TS, LOW_COMMIT_TS)); SweepableCellFilter filter = new SweepableCellFilter( commitTsCache, Sweeper.THOROUGH, HIGH_START_TS); List<CellToSweep> cells = filter.getCellsToSweep(candidate).cells(); assertThat(cells.size()).isEqualTo(1); assertThat(Iterables.getOnlyElement(cells).sortedTimestamps()).containsExactly(LOW_START_TS); }
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);  }