Source:
private SweepResults doRun(TableReference tableRef, SweepBatchConfig batchConfig, byte[] startRow, RunType runType, Sweeper sweeper) { long sweepTs = sweeper.getSweepTimestampSupplier().getSweepTimestamp( unreadableTimestampSupplier, immutableTimestampSupplier); CandidateCellForSweepingRequest request = ImmutableCandidateCellForSweepingRequest.builder() .startRowInclusive(startRow) .batchSizeHint(batchConfig.candidateBatchSize()) .minUncommittedStartTimestamp(Long.MIN_VALUE) .sweepTimestamp(sweepTs) .shouldCheckIfLatestValueIsEmpty(sweeper.shouldSweepLastCommitted()) .timestampsToIgnore(sweeper.getTimestampsToIgnore()) .build(); SweepableCellFilter sweepableCellFilter = new SweepableCellFilter(transactionService, sweeper, sweepTs); try (ClosableIterator<List<CandidateCellForSweeping>> candidates = keyValueService.getCandidateCellsForSweeping( tableRef, request)) { ExaminedCellLimit limit = new ExaminedCellLimit(startRow, batchConfig.maxCellTsPairsToExamine()); Iterator<BatchOfCellsToSweep> batchesToSweep = getBatchesToSweep( candidates, batchConfig, sweepableCellFilter, limit); long totalCellTsPairsExamined = 0; long totalCellTsPairsDeleted = 0; byte[] lastRow = startRow; while (batchesToSweep.hasNext()) { BatchOfCellsToSweep batch = batchesToSweep.next(); totalCellTsPairsDeleted += sweepBatch(tableRef, batch.cells(), runType, 2 * batchConfig.deleteBatchSize()); totalCellTsPairsExamined = batch.numCellTsPairsExaminedSoFar(); lastRow = batch.lastCellExamined().getRowName(); } return SweepResults.builder() .previousStartRow(startRow) .nextStartRow(Arrays.equals(startRow, lastRow) ? Optional.absent() : Optional.of(lastRow)) .cellTsPairsExamined(totalCellTsPairsExamined) .staleValuesDeleted(totalCellTsPairsDeleted) .sweptTimestamp(sweepTs) .build(); } }

Target:
private SweepResults doRun(TableReference tableRef, SweepBatchConfig batchConfig, byte[] startRow, RunType runType, Sweeper sweeper) { long sweepTs = sweeper.getSweepTimestampSupplier().getSweepTimestamp( unreadableTimestampSupplier, immutableTimestampSupplier); CandidateCellForSweepingRequest request = ImmutableCandidateCellForSweepingRequest.builder() .startRowInclusive(startRow) .batchSizeHint(batchConfig.candidateBatchSize()) .minUncommittedStartTimestamp(Long.MIN_VALUE) .sweepTimestamp(sweepTs) .shouldCheckIfLatestValueIsEmpty(sweeper.shouldSweepLastCommitted()) .timestampsToIgnore(sweeper.getTimestampsToIgnore()) .build(); SweepableCellFilter sweepableCellFilter = new SweepableCellFilter(transactionService, sweeper, sweepTs); try (ClosableIterator<List<CandidateCellForSweeping>> candidates = keyValueService.getCandidateCellsForSweeping( tableRef, request)) { ExaminedCellLimit limit = new ExaminedCellLimit(startRow, batchConfig.maxCellTsPairsToExamine()); Iterator<BatchOfCellsToSweep> batchesToSweep = getBatchesToSweep( candidates, batchConfig, sweepableCellFilter, limit); long totalCellTsPairsExamined = 0; long totalCellTsPairsDeleted = 0; byte[] lastRow = startRow; while (batchesToSweep.hasNext()) { BatchOfCellsToSweep batch = batchesToSweep.next(); totalCellTsPairsDeleted += sweepBatch(tableRef, batch.cells(), runType, 2 * batchConfig.deleteBatchSize()); totalCellTsPairsExamined = batch.numCellTsPairsExaminedSoFar(); lastRow = batch.lastCellExamined().getRowName(); } return SweepResults.builder() .previousStartRow(Optional.of(startRow)) .nextStartRow(Arrays.equals(startRow, lastRow) ? Optional.empty() : Optional.of(lastRow)) .cellTsPairsExamined(totalCellTsPairsExamined) .staleValuesDeleted(totalCellTsPairsDeleted) .sweptTimestamp(sweepTs) .build(); } }