@JsonIgnore public long getTimeElapsedSinceStartedSweeping() { return System.currentTimeMillis() - getTimeSweepStarted(); }
/** * Returns a new {@link SweepResults} representing cumulative results from this instance and {@code other}. * The operation is commutative. */ public SweepResults accumulateWith(SweepResults other) { return SweepResults.builder() .nextStartRow(maxRowOptional(getNextStartRow(), other.getNextStartRow())) .cellTsPairsExamined(getCellTsPairsExamined() + other.getCellTsPairsExamined()) .staleValuesDeleted(getStaleValuesDeleted() + other.getStaleValuesDeleted()) .minSweptTimestamp(Math.min(getMinSweptTimestamp(), other.getMinSweptTimestamp())) .timeInMillis(getTimeInMillis() + other.getTimeInMillis()) .timeSweepStarted(Math.min(getTimeSweepStarted(), other.getTimeSweepStarted())) .build(); }
@Test public void equalsIgnoresTimeSweepStarted() { SweepResults emptySweepResult = SweepResults.createEmptySweepResult(Optional.empty()); SweepResults laterEmptySweepResult = SweepResults.builder().from(emptySweepResult) .timeSweepStarted(emptySweepResult.getTimeSweepStarted() + 1) .build(); Assert.assertThat(emptySweepResult, Matchers.equalTo(laterEmptySweepResult)); } }
private void saveIntermediateSweepResults(TableToSweep tableToSweep, SweepResults results) { Preconditions.checkArgument(results.getNextStartRow().isPresent(), "Next start row should be present when saving intermediate results!"); txManager.runTaskWithRetry((TxTask) tx -> { if (!tableToSweep.hasPreviousProgress()) { // This is the first set of results being written for this table. sweepPriorityStore.update( tx, tableToSweep.getTableRef(), ImmutableUpdateSweepPriority.builder().newWriteCount(0L).build()); } SweepProgress newProgress = ImmutableSweepProgress.builder() .tableRef(tableToSweep.getTableRef()) .staleValuesDeleted(results.getStaleValuesDeleted()) .cellTsPairsExamined(results.getCellTsPairsExamined()) //noinspection OptionalGetWithoutIsPresent // covered by precondition above .startRow(results.getNextStartRow().get()) .startColumn(PtBytes.toBytes("unused")) .minimumSweptTimestamp(results.getMinSweptTimestamp()) .timeInMillis(results.getTimeInMillis()) .startTimeInMillis(results.getTimeSweepStarted()) .build(); sweepProgressStore.saveProgress(newProgress); return null; }); }
@JsonIgnore public long getTimeElapsedSinceStartedSweeping() { return System.currentTimeMillis() - getTimeSweepStarted(); }
/** * Returns a new {@link SweepResults} representing cumulative results from this instance and {@code other}. * The operation is commutative. */ public SweepResults accumulateWith(SweepResults other) { return SweepResults.builder() .nextStartRow(maxRowOptional(getNextStartRow(), other.getNextStartRow())) .cellTsPairsExamined(getCellTsPairsExamined() + other.getCellTsPairsExamined()) .staleValuesDeleted(getStaleValuesDeleted() + other.getStaleValuesDeleted()) .minSweptTimestamp(Math.min(getMinSweptTimestamp(), other.getMinSweptTimestamp())) .timeInMillis(getTimeInMillis() + other.getTimeInMillis()) .timeSweepStarted(Math.min(getTimeSweepStarted(), other.getTimeSweepStarted())) .build(); }
private void saveIntermediateSweepResults(TableToSweep tableToSweep, SweepResults results) { Preconditions.checkArgument(results.getNextStartRow().isPresent(), "Next start row should be present when saving intermediate results!"); txManager.runTaskWithRetry((TxTask) tx -> { if (!tableToSweep.hasPreviousProgress()) { // This is the first set of results being written for this table. sweepPriorityStore.update( tx, tableToSweep.getTableRef(), ImmutableUpdateSweepPriority.builder().newWriteCount(0L).build()); } SweepProgress newProgress = ImmutableSweepProgress.builder() .tableRef(tableToSweep.getTableRef()) .staleValuesDeleted(results.getStaleValuesDeleted()) .cellTsPairsExamined(results.getCellTsPairsExamined()) //noinspection OptionalGetWithoutIsPresent // covered by precondition above .startRow(results.getNextStartRow().get()) .startColumn(PtBytes.toBytes("unused")) .minimumSweptTimestamp(results.getMinSweptTimestamp()) .timeInMillis(results.getTimeInMillis()) .startTimeInMillis(results.getTimeSweepStarted()) .build(); sweepProgressStore.saveProgress(newProgress); return null; }); }