@Override @Before public void setup() { super.setup(); sweeperService = new SweeperServiceImpl(specificTableSweeper, sweepBatchConfigSource); }
@Override public SweepTableResponse sweepTable( String tableName, Optional<String> startRow, Optional<Boolean> fullSweep, Optional<Integer> maxCellTsPairsToExamine, Optional<Integer> candidateBatchSize, Optional<Integer> deleteBatchSize) { TableReference tableRef = getTableRef(tableName); checkTableExists(tableName, tableRef); byte[] decodedStartRow = startRow.map(PtBytes::decodeHexString).orElse(PtBytes.EMPTY_BYTE_ARRAY); SweepBatchConfig config = buildConfigWithOverrides(maxCellTsPairsToExamine, candidateBatchSize, deleteBatchSize); return SweepTableResponse.from(runSweep(fullSweep, tableRef, decodedStartRow, config)); }
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.updateTimeMetricsOneIteration(results.getTimeInMillis(), results.getTimeElapsedSinceStartedSweeping()); cumulativeResults = cumulativeResults.accumulateWith(results); } return cumulativeResults; }
private SweepResults runSweep(Optional<Boolean> fullSweep, TableReference tableRef, byte[] decodedStartRow, SweepBatchConfig config) { if (!fullSweep.isPresent()) { log.warn("fullSweep parameter was not specified, defaulting to true"); } if (fullSweep.orElse(true)) { log.info("Running sweep of full table {}, " + "with maxCellTsPairsToExamine: {}, candidateBatchSize: {}, deleteBatchSize: {}, " + "starting from row {}", LoggingArgs.tableRef(tableRef), SafeArg.of("maxCellTsPairsToExamine", config.maxCellTsPairsToExamine()), SafeArg.of("candidateBatchSize", config.candidateBatchSize()), SafeArg.of("deleteBatchSize", config.deleteBatchSize()), UnsafeArg.of("decodedStartRow", decodedStartRow)); return runFullSweepWithoutSavingResults(tableRef, decodedStartRow, config); } else { log.info("Running sweep of a single batch on table {}, " + "with maxCellTsPairsToExamine: {}, candidateBatchSize: {}, deleteBatchSize: {}, " + "starting from row {}", LoggingArgs.tableRef(tableRef), SafeArg.of("maxCellTsPairsToExamine", config.maxCellTsPairsToExamine()), SafeArg.of("candidateBatchSize", config.candidateBatchSize()), SafeArg.of("deleteBatchSize", config.deleteBatchSize()), UnsafeArg.of("decodedStartRow", decodedStartRow)); return runOneBatchWithoutSavingResults(tableRef, decodedStartRow, config); } }
private SweepResults runSweep(Optional<Boolean> fullSweep, TableReference tableRef, byte[] decodedStartRow, SweepBatchConfig config) { if (!fullSweep.isPresent()) { log.warn("fullSweep parameter was not specified, defaulting to true"); } if (fullSweep.orElse(true)) { log.info("Running sweep of full table {}, " + "with maxCellTsPairsToExamine: {}, candidateBatchSize: {}, deleteBatchSize: {}, " + "starting from row {}", LoggingArgs.tableRef(tableRef), SafeArg.of("maxCellTsPairsToExamine", config.maxCellTsPairsToExamine()), SafeArg.of("candidateBatchSize", config.candidateBatchSize()), SafeArg.of("deleteBatchSize", config.deleteBatchSize()), UnsafeArg.of("decodedStartRow", decodedStartRow)); return runFullSweepWithoutSavingResults(tableRef, decodedStartRow, config); } else { log.info("Running sweep of a single batch on table {}, " + "with maxCellTsPairsToExamine: {}, candidateBatchSize: {}, deleteBatchSize: {}, " + "starting from row {}", LoggingArgs.tableRef(tableRef), SafeArg.of("maxCellTsPairsToExamine", config.maxCellTsPairsToExamine()), SafeArg.of("candidateBatchSize", config.candidateBatchSize()), SafeArg.of("deleteBatchSize", config.deleteBatchSize()), UnsafeArg.of("decodedStartRow", decodedStartRow)); return runOneBatchWithoutSavingResults(tableRef, decodedStartRow, config); } }
@Override public SweepTableResponse sweepTable( String tableName, Optional<String> startRow, Optional<Boolean> fullSweep, Optional<Integer> maxCellTsPairsToExamine, Optional<Integer> candidateBatchSize, Optional<Integer> deleteBatchSize) { TableReference tableRef = getTableRef(tableName); checkTableExists(tableName, tableRef); byte[] decodedStartRow = startRow.map(PtBytes::decodeHexString).orElse(PtBytes.EMPTY_BYTE_ARRAY); SweepBatchConfig config = buildConfigWithOverrides(maxCellTsPairsToExamine, candidateBatchSize, deleteBatchSize); return SweepTableResponse.from(runSweep(fullSweep, tableRef, decodedStartRow, config)); }
private static SpecificTableSweeper initializeSweepEndpoint( Consumer<Object> env, KeyValueService kvs, TransactionManager transactionManager, SweepTaskRunner sweepRunner, BackgroundSweeperPerformanceLogger sweepPerfLogger, LegacySweepMetrics sweepMetrics, boolean initializeAsync, AdjustableSweepBatchConfigSource sweepBatchConfigSource) { SpecificTableSweeper specificTableSweeper = SpecificTableSweeper.create( transactionManager, kvs, sweepRunner, SweepTableFactory.of(), sweepPerfLogger, sweepMetrics, initializeAsync); env.accept(new SweeperServiceImpl(specificTableSweeper, sweepBatchConfigSource)); return specificTableSweeper; }
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.updateTimeMetricsOneIteration(results.getTimeInMillis(), results.getTimeElapsedSinceStartedSweeping()); cumulativeResults = cumulativeResults.accumulateWith(results); } return cumulativeResults; }
@Override @Before public void setup() { super.setup(); sweeperService = new SweeperServiceImpl(specificTableSweeper, sweepBatchConfigSource); }
private static SpecificTableSweeper initializeSweepEndpoint( Consumer<Object> env, KeyValueService kvs, TransactionManager transactionManager, SweepTaskRunner sweepRunner, BackgroundSweeperPerformanceLogger sweepPerfLogger, LegacySweepMetrics sweepMetrics, boolean initializeAsync, AdjustableSweepBatchConfigSource sweepBatchConfigSource) { SpecificTableSweeper specificTableSweeper = SpecificTableSweeper.create( transactionManager, kvs, sweepRunner, SweepTableFactory.of(), sweepPerfLogger, sweepMetrics, initializeAsync); env.accept(new SweeperServiceImpl(specificTableSweeper, sweepBatchConfigSource)); return specificTableSweeper; }