Search in sources :

Example 1 with InMemoryTimestampService

use of com.palantir.timestamp.InMemoryTimestampService in project atlasdb by palantir.

the class AsyncPuncherTest method setup.

@Before
public void setup() {
    PuncherStore puncherStore = InMemoryPuncherStore.create();
    Clock clock = new SystemClock();
    Puncher puncher = SimplePuncher.create(puncherStore, clock, Suppliers.ofInstance(TRANSACTION_TIMEOUT));
    timestampService = new InMemoryTimestampService();
    asyncPuncher = AsyncPuncher.create(puncher, ASYNC_PUNCHER_INTERVAL);
}
Also used : SystemClock(com.palantir.common.time.SystemClock) InMemoryTimestampService(com.palantir.timestamp.InMemoryTimestampService) Clock(com.palantir.common.time.Clock) SystemClock(com.palantir.common.time.SystemClock) Before(org.junit.Before)

Example 2 with InMemoryTimestampService

use of com.palantir.timestamp.InMemoryTimestampService in project atlasdb by palantir.

the class TableTasksTest method setup.

@Before
public void setup() {
    kvs = new InMemoryKeyValueService(true);
    TimestampService tsService = new InMemoryTimestampService();
    LockClient lockClient = LockClient.of("sweep client");
    lockService = LockServiceImpl.create(LockServerOptions.builder().isStandaloneServer(false).build());
    TransactionService txService = TransactionServices.createTransactionService(kvs);
    Supplier<AtlasDbConstraintCheckingMode> constraints = Suppliers.ofInstance(AtlasDbConstraintCheckingMode.NO_CONSTRAINT_CHECKING);
    ConflictDetectionManager cdm = ConflictDetectionManagers.createWithoutWarmingCache(kvs);
    SweepStrategyManager ssm = SweepStrategyManagers.createDefault(kvs);
    Cleaner cleaner = new NoOpCleaner();
    SerializableTransactionManager transactionManager = SerializableTransactionManager.createForTest(kvs, tsService, lockClient, lockService, txService, constraints, cdm, ssm, cleaner, AbstractTransactionTest.GET_RANGES_THREAD_POOL_SIZE, AbstractTransactionTest.DEFAULT_GET_RANGES_CONCURRENCY, () -> AtlasDbConstants.DEFAULT_TIMESTAMP_CACHE_SIZE, MultiTableSweepQueueWriter.NO_OP);
    txManager = transactionManager;
}
Also used : SweepStrategyManager(com.palantir.atlasdb.transaction.impl.SweepStrategyManager) AtlasDbConstraintCheckingMode(com.palantir.atlasdb.transaction.api.AtlasDbConstraintCheckingMode) TransactionService(com.palantir.atlasdb.transaction.service.TransactionService) LockClient(com.palantir.lock.LockClient) NoOpCleaner(com.palantir.atlasdb.cleaner.NoOpCleaner) SerializableTransactionManager(com.palantir.atlasdb.transaction.impl.SerializableTransactionManager) ConflictDetectionManager(com.palantir.atlasdb.transaction.impl.ConflictDetectionManager) InMemoryTimestampService(com.palantir.timestamp.InMemoryTimestampService) InMemoryTimestampService(com.palantir.timestamp.InMemoryTimestampService) TimestampService(com.palantir.timestamp.TimestampService) Cleaner(com.palantir.atlasdb.cleaner.Cleaner) NoOpCleaner(com.palantir.atlasdb.cleaner.NoOpCleaner) Before(org.junit.Before)

Example 3 with InMemoryTimestampService

use of com.palantir.timestamp.InMemoryTimestampService in project atlasdb by palantir.

the class InMemoryAtlasDbFactory method createInMemoryTransactionManagerInternal.

private static SerializableTransactionManager createInMemoryTransactionManagerInternal(Set<Schema> schemas) {
    TimestampService ts = new InMemoryTimestampService();
    KeyValueService keyValueService = new InMemoryKeyValueService(false);
    schemas.forEach(s -> Schemas.createTablesAndIndexes(s, keyValueService));
    TransactionTables.createTables(keyValueService);
    TransactionService transactionService = TransactionServices.createTransactionService(keyValueService);
    LockService lock = LockRefreshingLockService.create(LockServiceImpl.create(LockServerOptions.builder().isStandaloneServer(false).build()));
    LockClient client = LockClient.of("in memory atlasdb instance");
    ConflictDetectionManager conflictManager = ConflictDetectionManagers.createWithoutWarmingCache(keyValueService);
    SweepStrategyManager sweepStrategyManager = SweepStrategyManagers.createDefault(keyValueService);
    CleanupFollower follower = CleanupFollower.create(schemas);
    Cleaner cleaner = new DefaultCleanerBuilder(keyValueService, lock, ts, client, ImmutableList.of(follower), transactionService).buildCleaner();
    SerializableTransactionManager ret = SerializableTransactionManager.createForTest(keyValueService, ts, client, lock, transactionService, Suppliers.ofInstance(AtlasDbConstraintCheckingMode.FULL_CONSTRAINT_CHECKING_THROWS_EXCEPTIONS), conflictManager, sweepStrategyManager, cleaner, DEFAULT_MAX_CONCURRENT_RANGES, DEFAULT_GET_RANGES_CONCURRENCY, () -> DEFAULT_TIMESTAMP_CACHE_SIZE, MultiTableSweepQueueWriter.NO_OP);
    cleaner.start(ret);
    return ret;
}
Also used : SweepStrategyManager(com.palantir.atlasdb.transaction.impl.SweepStrategyManager) InMemoryKeyValueService(com.palantir.atlasdb.keyvalue.impl.InMemoryKeyValueService) KeyValueService(com.palantir.atlasdb.keyvalue.api.KeyValueService) TransactionService(com.palantir.atlasdb.transaction.service.TransactionService) LockRefreshingLockService(com.palantir.lock.client.LockRefreshingLockService) LockService(com.palantir.lock.LockService) InMemoryKeyValueService(com.palantir.atlasdb.keyvalue.impl.InMemoryKeyValueService) SerializableTransactionManager(com.palantir.atlasdb.transaction.impl.SerializableTransactionManager) LockClient(com.palantir.lock.LockClient) DefaultCleanerBuilder(com.palantir.atlasdb.cleaner.DefaultCleanerBuilder) ConflictDetectionManager(com.palantir.atlasdb.transaction.impl.ConflictDetectionManager) InMemoryTimestampService(com.palantir.timestamp.InMemoryTimestampService) InMemoryTimestampService(com.palantir.timestamp.InMemoryTimestampService) TimestampService(com.palantir.timestamp.TimestampService) CleanupFollower(com.palantir.atlasdb.cleaner.CleanupFollower) Cleaner(com.palantir.atlasdb.cleaner.Cleaner)

Example 4 with InMemoryTimestampService

use of com.palantir.timestamp.InMemoryTimestampService in project atlasdb by palantir.

the class SnapshotTransactionManagerTest method canCloseTransactionManagerWithNonCloseableLockService.

@Test
public void canCloseTransactionManagerWithNonCloseableLockService() {
    SnapshotTransactionManager newTransactionManager = new SnapshotTransactionManager(keyValueService, new LegacyTimelockService(new InMemoryTimestampService(), closeableLockService, LockClient.of("lock")), // not closeable
    mock(LockService.class), null, null, null, null, cleaner, false, () -> AtlasDbConstants.DEFAULT_TRANSACTION_LOCK_ACQUIRE_TIMEOUT_MS, TimestampTrackerImpl.createNoOpTracker(), TransactionTestConstants.GET_RANGES_THREAD_POOL_SIZE, TransactionTestConstants.DEFAULT_GET_RANGES_CONCURRENCY, () -> AtlasDbConstants.DEFAULT_TIMESTAMP_CACHE_SIZE, MultiTableSweepQueueWriter.NO_OP);
    // should not throw
    newTransactionManager.close();
}
Also used : LegacyTimelockService(com.palantir.lock.impl.LegacyTimelockService) CloseableLockService(com.palantir.lock.CloseableLockService) LockService(com.palantir.lock.LockService) InMemoryTimestampService(com.palantir.timestamp.InMemoryTimestampService) Test(org.junit.Test)

Example 5 with InMemoryTimestampService

use of com.palantir.timestamp.InMemoryTimestampService in project atlasdb by palantir.

the class AbstractBackgroundSweeperIntegrationTest method setup.

@Before
public void setup() {
    TimestampService tsService = new InMemoryTimestampService();
    kvs = SweepStatsKeyValueService.create(getKeyValueService(), tsService, () -> AtlasDbConstants.DEFAULT_SWEEP_WRITE_THRESHOLD, () -> AtlasDbConstants.DEFAULT_SWEEP_WRITE_SIZE_THRESHOLD);
    SweepStrategyManager ssm = SweepStrategyManagers.createDefault(kvs);
    txService = TransactionServices.createTransactionService(kvs);
    txManager = SweepTestUtils.setupTxManager(kvs, tsService, ssm, txService);
    LongSupplier tsSupplier = sweepTimestamp::get;
    PersistentLockManager persistentLockManager = new PersistentLockManager(SweepTestUtils.getPersistentLockService(kvs), AtlasDbConstants.DEFAULT_SWEEP_PERSISTENT_LOCK_WAIT_MILLIS);
    CellsSweeper cellsSweeper = new CellsSweeper(txManager, kvs, persistentLockManager, ImmutableList.of());
    SweepTaskRunner sweepRunner = new SweepTaskRunner(kvs, tsSupplier, tsSupplier, txService, ssm, cellsSweeper);
    SweepMetricsManager sweepMetricsManager = new SweepMetricsManager();
    specificTableSweeper = SpecificTableSweeper.create(txManager, kvs, sweepRunner, SweepTableFactory.of(), new NoOpBackgroundSweeperPerformanceLogger(), sweepMetricsManager, false);
    sweepBatchConfigSource = AdjustableSweepBatchConfigSource.create(() -> sweepBatchConfig);
    backgroundSweeper = BackgroundSweeperImpl.create(sweepBatchConfigSource, // sweepEnabled
    () -> true, // sweepPauseMillis
    () -> 10L, persistentLockManager, specificTableSweeper);
}
Also used : SweepStrategyManager(com.palantir.atlasdb.transaction.impl.SweepStrategyManager) InMemoryTimestampService(com.palantir.timestamp.InMemoryTimestampService) LongSupplier(java.util.function.LongSupplier) SweepMetricsManager(com.palantir.atlasdb.sweep.metrics.SweepMetricsManager) InMemoryTimestampService(com.palantir.timestamp.InMemoryTimestampService) TimestampService(com.palantir.timestamp.TimestampService) Before(org.junit.Before)

Aggregations

InMemoryTimestampService (com.palantir.timestamp.InMemoryTimestampService)9 Before (org.junit.Before)6 TimestampService (com.palantir.timestamp.TimestampService)5 SweepStrategyManager (com.palantir.atlasdb.transaction.impl.SweepStrategyManager)3 TransactionService (com.palantir.atlasdb.transaction.service.TransactionService)3 Cleaner (com.palantir.atlasdb.cleaner.Cleaner)2 KeyValueService (com.palantir.atlasdb.keyvalue.api.KeyValueService)2 InMemoryKeyValueService (com.palantir.atlasdb.keyvalue.impl.InMemoryKeyValueService)2 ConflictDetectionManager (com.palantir.atlasdb.transaction.impl.ConflictDetectionManager)2 SerializableTransactionManager (com.palantir.atlasdb.transaction.impl.SerializableTransactionManager)2 LockClient (com.palantir.lock.LockClient)2 LockService (com.palantir.lock.LockService)2 CleanupFollower (com.palantir.atlasdb.cleaner.CleanupFollower)1 DefaultCleanerBuilder (com.palantir.atlasdb.cleaner.DefaultCleanerBuilder)1 NoOpCleaner (com.palantir.atlasdb.cleaner.NoOpCleaner)1 StatsTrackingKeyValueService (com.palantir.atlasdb.keyvalue.impl.StatsTrackingKeyValueService)1 TracingKeyValueService (com.palantir.atlasdb.keyvalue.impl.TracingKeyValueService)1 TrackingKeyValueService (com.palantir.atlasdb.keyvalue.impl.TrackingKeyValueService)1 AtlasDbServices (com.palantir.atlasdb.services.AtlasDbServices)1 SweepMetricsManager (com.palantir.atlasdb.sweep.metrics.SweepMetricsManager)1