Search in sources :

Example 1 with SweepProgress

use of com.palantir.atlasdb.sweep.progress.SweepProgress in project atlasdb by palantir.

the class BackgroundSweeperFastTest method testWriteProgressAfterIncompleteRunUsesSystemTimeForStart.

@Test
public void testWriteProgressAfterIncompleteRunUsesSystemTimeForStart() {
    setNoProgress();
    setNextTableToSweep(TABLE_REF);
    setupTaskRunner(ImmutableSweepResults.builder().staleValuesDeleted(2).cellTsPairsExamined(10).minSweptTimestamp(12345L).nextStartRow(Optional.of(new byte[] { 1, 2, 3 })).timeInMillis(10L).timeSweepStarted(Long.MAX_VALUE).build());
    backgroundSweeper.runOnce();
    ArgumentCaptor<SweepProgress> argumentCaptor = ArgumentCaptor.forClass(SweepProgress.class);
    Mockito.verify(progressStore).saveProgress(argumentCaptor.capture());
    SweepProgress savedProgress = argumentCaptor.getValue();
    long timeSweepStarted = savedProgress.startTimeInMillis();
    Assertions.assertThat(timeSweepStarted).isLessThanOrEqualTo(System.currentTimeMillis());
    Assertions.assertThat(timeSweepStarted).isGreaterThan(System.currentTimeMillis() - 1000L);
    Assertions.assertThat(savedProgress).isEqualTo(ImmutableSweepProgress.builder().tableRef(TABLE_REF).staleValuesDeleted(2).cellTsPairsExamined(10).minimumSweptTimestamp(12345L).startRow(new byte[] { 1, 2, 3 }).startColumn(PtBytes.toBytes("unused")).timeInMillis(10L).startTimeInMillis(timeSweepStarted).build());
}
Also used : SweepProgress(com.palantir.atlasdb.sweep.progress.SweepProgress) ImmutableSweepProgress(com.palantir.atlasdb.sweep.progress.ImmutableSweepProgress) Test(org.junit.Test)

Aggregations

ImmutableSweepProgress (com.palantir.atlasdb.sweep.progress.ImmutableSweepProgress)1 SweepProgress (com.palantir.atlasdb.sweep.progress.SweepProgress)1 Test (org.junit.Test)1