Search in sources :

Example 1 with LegacySweepMetrics

use of com.palantir.atlasdb.sweep.metrics.LegacySweepMetrics 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)

Example 2 with LegacySweepMetrics

use of com.palantir.atlasdb.sweep.metrics.LegacySweepMetrics in project atlasdb by palantir.

the class AbstractBackgroundSweeperIntegrationTest method setup.

@Before
public void setup() {
    kvs = SweepStatsKeyValueService.create(getKeyValueService(), services.getTimestampService(), () -> AtlasDbConstants.DEFAULT_SWEEP_WRITE_THRESHOLD, () -> AtlasDbConstants.DEFAULT_SWEEP_WRITE_SIZE_THRESHOLD, () -> true);
    SweepStrategyManager ssm = SweepStrategyManagers.createDefault(kvs);
    txService = TransactionServices.createV1TransactionService(kvs);
    txManager = SweepTestUtils.setupTxManager(kvs, services.getLegacyTimelockService(), services.getTimestampManagementService(), ssm, txService);
    CellsSweeper cellsSweeper = new CellsSweeper(txManager, kvs, ImmutableList.of());
    SweepTaskRunner sweepRunner = new SweepTaskRunner(kvs, AbstractBackgroundSweeperIntegrationTest::getTimestamp, AbstractBackgroundSweeperIntegrationTest::getTimestamp, txService, cellsSweeper, null);
    LegacySweepMetrics sweepMetrics = new LegacySweepMetrics(metricsManager.getRegistry());
    specificTableSweeper = SpecificTableSweeper.create(txManager, kvs, sweepRunner, SweepTableFactory.of(), new NoOpBackgroundSweeperPerformanceLogger(), sweepMetrics, false);
    sweepBatchConfigSource = AdjustableSweepBatchConfigSource.create(metricsManager, () -> sweepBatchConfig);
    backgroundSweeper = new BackgroundSweepThread(txManager.getLockService(), NextTableToSweepProvider.create(kvs, txManager.getLockService(), specificTableSweeper.getSweepPriorityStore()), sweepBatchConfigSource, // sweepEnabled
    () -> true, // sweepPauseMillis
    () -> 10L, SweepPriorityOverrideConfig::defaultConfig, specificTableSweeper, SweepOutcomeMetrics.registerLegacy(metricsManager), new CountDownLatch(1), 0);
}
Also used : SweepStrategyManager(com.palantir.atlasdb.transaction.impl.SweepStrategyManager) LegacySweepMetrics(com.palantir.atlasdb.sweep.metrics.LegacySweepMetrics) CountDownLatch(java.util.concurrent.CountDownLatch) Before(org.junit.Before)

Aggregations

LegacySweepMetrics (com.palantir.atlasdb.sweep.metrics.LegacySweepMetrics)2 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 SweepStrategyManager (com.palantir.atlasdb.transaction.impl.SweepStrategyManager)1 CountDownLatch (java.util.concurrent.CountDownLatch)1 Before (org.junit.Before)1