use of com.palantir.atlasdb.keyvalue.api.SweepResults in project atlasdb by palantir.
the class SweeperServiceImpl method runFullSweepWithoutSavingResults.
private SweepResults runFullSweepWithoutSavingResults(TableReference tableRef, byte[] startRow, SweepBatchConfig sweepBatchConfig) {
SweepResults cumulativeResults = SweepResults.createEmptySweepResult(Optional.of(startRow));
while (cumulativeResults.getNextStartRow().isPresent()) {
SweepResults results = runOneBatchWithoutSavingResults(tableRef, cumulativeResults.getNextStartRow().get(), sweepBatchConfig);
specificTableSweeper.updateMetricsOneIteration(results, tableRef);
cumulativeResults = cumulativeResults.accumulateWith(results);
}
return cumulativeResults;
}
use of com.palantir.atlasdb.keyvalue.api.SweepResults in project atlasdb by palantir.
the class BackgroundSweeperFastTest method testMetricsUseIntermediateResultsPerIteration.
@Test
public void testMetricsUseIntermediateResultsPerIteration() {
setProgress(ImmutableSweepProgress.builder().tableRef(TABLE_REF).staleValuesDeleted(3).cellTsPairsExamined(11).minimumSweptTimestamp(4567L).startRow(new byte[] { 1, 2, 3 }).startColumn(PtBytes.toBytes("unused")).timeInMillis(10L).startTimeInMillis(20L).build());
SweepResults intermediateResults = ImmutableSweepResults.builder().staleValuesDeleted(2).cellTsPairsExamined(10).minSweptTimestamp(12345L).timeInMillis(20L).timeSweepStarted(50L).build();
setupTaskRunner(intermediateResults);
backgroundSweeper.runOnce();
Mockito.verify(sweepMetricsManager).updateMetrics(intermediateResults, TABLE_REF);
}
use of com.palantir.atlasdb.keyvalue.api.SweepResults in project atlasdb by palantir.
the class SpecificTableSweeper method processSweepResults.
private void processSweepResults(TableToSweep tableToSweep, SweepResults currentIteration) {
updateMetricsOneIteration(currentIteration, tableToSweep.getTableRef());
SweepResults cumulativeResults = getCumulativeSweepResults(tableToSweep, currentIteration);
if (currentIteration.getNextStartRow().isPresent()) {
saveIntermediateSweepResults(tableToSweep, cumulativeResults);
} else {
processFinishedSweep(tableToSweep, cumulativeResults);
}
}
use of com.palantir.atlasdb.keyvalue.api.SweepResults in project atlasdb by palantir.
the class SpecificTableSweeper method runOneIteration.
SweepResults runOneIteration(TableReference tableRef, byte[] startRow, SweepBatchConfig batchConfig) {
try {
SweepResults results = sweepRunner.run(tableRef, batchConfig, startRow);
logSweepPerformance(tableRef, startRow, results);
return results;
} catch (RuntimeException e) {
// This error may be logged on some paths above, but I prefer to log defensively.
logSweepError(tableRef, startRow, batchConfig, e);
throw e;
}
}
use of com.palantir.atlasdb.keyvalue.api.SweepResults in project atlasdb by palantir.
the class SweeperServiceImplTest method sweepsEntireTableByDefault.
@Test
public void sweepsEntireTableByDefault() {
List<byte[]> startRows = ImmutableList.of(PtBytes.EMPTY_BYTE_ARRAY, new byte[] { 0x10 }, new byte[] { 0x50 });
for (int i = 0; i < startRows.size(); i++) {
byte[] currentRow = startRows.get(i);
Optional<byte[]> nextRow = (i + 1) == startRows.size() ? Optional.empty() : Optional.of(startRows.get(i + 1));
SweepResults results = SweepResults.createEmptySweepResult(nextRow);
when(sweepTaskRunner.run(any(), any(), eq(currentRow))).thenReturn(results);
}
sweeperService.sweepTableFully(TABLE_REF.getQualifiedName());
startRows.forEach(row -> verify(sweepTaskRunner).run(any(), any(), eq(row)));
verifyNoMoreInteractions(sweepTaskRunner);
}
Aggregations