Search in sources :

Example 1 with ShouldRunBackgroundSweepSupplier

use of com.palantir.atlasdb.config.ShouldRunBackgroundSweepSupplier in project atlasdb by palantir.

the class TransactionManagers method initializeSweepEndpointAndBackgroundProcess.

private static BackgroundSweeperImpl initializeSweepEndpointAndBackgroundProcess(MetricsManager metricsManager, AtlasDbConfig config, Supplier<AtlasDbRuntimeConfig> runtimeConfigSupplier, Consumer<Object> env, KeyValueService kvs, TransactionService transactionService, CleanupFollower follower, TransactionManager transactionManager, boolean runInBackground) {
    CellsSweeper cellsSweeper = new CellsSweeper(transactionManager, kvs, ImmutableList.of(follower));
    LegacySweepMetrics sweepMetrics = new LegacySweepMetrics(metricsManager.getRegistry());
    SweepTaskRunner sweepRunner = new SweepTaskRunner(kvs, transactionManager::getUnreadableTimestamp, transactionManager::getImmutableTimestamp, transactionService, cellsSweeper, sweepMetrics);
    BackgroundSweeperPerformanceLogger sweepPerfLogger = new NoOpBackgroundSweeperPerformanceLogger();
    AdjustableSweepBatchConfigSource sweepBatchConfigSource = AdjustableSweepBatchConfigSource.create(metricsManager, () -> getSweepBatchConfig(runtimeConfigSupplier.get().sweep()));
    SpecificTableSweeper specificTableSweeper = initializeSweepEndpoint(env, kvs, transactionManager, sweepRunner, sweepPerfLogger, sweepMetrics, config.initializeAsync(), sweepBatchConfigSource);
    boolean sweepQueueWritesEnabled = config.targetedSweep().enableSweepQueueWrites();
    BackgroundSweeperImpl backgroundSweeper = BackgroundSweeperImpl.create(metricsManager, sweepBatchConfigSource, new ShouldRunBackgroundSweepSupplier(() -> runtimeConfigSupplier.get().sweep(), sweepQueueWritesEnabled)::getAsBoolean, () -> runtimeConfigSupplier.get().sweep().sweepThreads(), () -> runtimeConfigSupplier.get().sweep().pauseMillis(), () -> runtimeConfigSupplier.get().sweep().sweepPriorityOverrides(), specificTableSweeper);
    transactionManager.registerClosingCallback(backgroundSweeper::shutdown);
    if (runInBackground) {
        backgroundSweeper.runInBackground();
    }
    return backgroundSweeper;
}
Also used : LegacySweepMetrics(com.palantir.atlasdb.sweep.metrics.LegacySweepMetrics) BackgroundSweeperImpl(com.palantir.atlasdb.sweep.BackgroundSweeperImpl) AdjustableSweepBatchConfigSource(com.palantir.atlasdb.sweep.AdjustableSweepBatchConfigSource) SpecificTableSweeper(com.palantir.atlasdb.sweep.SpecificTableSweeper) ShouldRunBackgroundSweepSupplier(com.palantir.atlasdb.config.ShouldRunBackgroundSweepSupplier) CellsSweeper(com.palantir.atlasdb.sweep.CellsSweeper) NoOpBackgroundSweeperPerformanceLogger(com.palantir.atlasdb.sweep.NoOpBackgroundSweeperPerformanceLogger) SweepTaskRunner(com.palantir.atlasdb.sweep.SweepTaskRunner) NoOpBackgroundSweeperPerformanceLogger(com.palantir.atlasdb.sweep.NoOpBackgroundSweeperPerformanceLogger) BackgroundSweeperPerformanceLogger(com.palantir.atlasdb.sweep.BackgroundSweeperPerformanceLogger)

Aggregations

ShouldRunBackgroundSweepSupplier (com.palantir.atlasdb.config.ShouldRunBackgroundSweepSupplier)1 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 LegacySweepMetrics (com.palantir.atlasdb.sweep.metrics.LegacySweepMetrics)1