Search in sources :

Example 1 with AdjustableSweepBatchConfigSource

use of com.palantir.atlasdb.sweep.AdjustableSweepBatchConfigSource in project atlasdb by palantir.

the class TransactionManagers method initializeSweepEndpointAndBackgroundProcess.

private static BackgroundSweeperImpl initializeSweepEndpointAndBackgroundProcess(AtlasDbConfig config, Supplier<AtlasDbRuntimeConfig> runtimeConfigSupplier, Consumer<Object> env, KeyValueService kvs, TransactionService transactionService, SweepStrategyManager sweepStrategyManager, CleanupFollower follower, SerializableTransactionManager transactionManager, PersistentLockManager persistentLockManager) {
    CellsSweeper cellsSweeper = new CellsSweeper(transactionManager, kvs, persistentLockManager, ImmutableList.of(follower));
    SweepMetricsManager sweepMetricsManager = new SweepMetricsManager();
    SweepTaskRunner sweepRunner = new SweepTaskRunner(kvs, transactionManager::getUnreadableTimestamp, transactionManager::getImmutableTimestamp, transactionService, sweepStrategyManager, cellsSweeper, sweepMetricsManager);
    BackgroundSweeperPerformanceLogger sweepPerfLogger = new NoOpBackgroundSweeperPerformanceLogger();
    AdjustableSweepBatchConfigSource sweepBatchConfigSource = AdjustableSweepBatchConfigSource.create(() -> getSweepBatchConfig(runtimeConfigSupplier.get().sweep(), config.keyValueService()));
    SweepMetricsManager sweepMetrics = new SweepMetricsManager();
    SpecificTableSweeper specificTableSweeper = initializeSweepEndpoint(env, kvs, transactionManager, sweepRunner, sweepPerfLogger, sweepMetrics, config.initializeAsync(), sweepBatchConfigSource);
    BackgroundSweeperImpl backgroundSweeper = BackgroundSweeperImpl.create(sweepBatchConfigSource, () -> runtimeConfigSupplier.get().sweep().enabled(), () -> runtimeConfigSupplier.get().sweep().pauseMillis(), persistentLockManager, specificTableSweeper);
    transactionManager.registerClosingCallback(backgroundSweeper::shutdown);
    backgroundSweeper.runInBackground();
    return backgroundSweeper;
}
Also used : BackgroundSweeperImpl(com.palantir.atlasdb.sweep.BackgroundSweeperImpl) AdjustableSweepBatchConfigSource(com.palantir.atlasdb.sweep.AdjustableSweepBatchConfigSource) SpecificTableSweeper(com.palantir.atlasdb.sweep.SpecificTableSweeper) CellsSweeper(com.palantir.atlasdb.sweep.CellsSweeper) NoOpBackgroundSweeperPerformanceLogger(com.palantir.atlasdb.sweep.NoOpBackgroundSweeperPerformanceLogger) SweepMetricsManager(com.palantir.atlasdb.sweep.metrics.SweepMetricsManager) SweepTaskRunner(com.palantir.atlasdb.sweep.SweepTaskRunner) NoOpBackgroundSweeperPerformanceLogger(com.palantir.atlasdb.sweep.NoOpBackgroundSweeperPerformanceLogger) BackgroundSweeperPerformanceLogger(com.palantir.atlasdb.sweep.BackgroundSweeperPerformanceLogger)

Aggregations

AdjustableSweepBatchConfigSource (com.palantir.atlasdb.sweep.AdjustableSweepBatchConfigSource)1 BackgroundSweeperImpl (com.palantir.atlasdb.sweep.BackgroundSweeperImpl)1 BackgroundSweeperPerformanceLogger (com.palantir.atlasdb.sweep.BackgroundSweeperPerformanceLogger)1 CellsSweeper (com.palantir.atlasdb.sweep.CellsSweeper)1 NoOpBackgroundSweeperPerformanceLogger (com.palantir.atlasdb.sweep.NoOpBackgroundSweeperPerformanceLogger)1 SpecificTableSweeper (com.palantir.atlasdb.sweep.SpecificTableSweeper)1 SweepTaskRunner (com.palantir.atlasdb.sweep.SweepTaskRunner)1 SweepMetricsManager (com.palantir.atlasdb.sweep.metrics.SweepMetricsManager)1