@Override public TimestampService createTimestampService( KeyValueService rawKvs, Optional<TableReference> unused, boolean initializeAsync) { if (initializeAsync) { log.warn("Asynchronous initialization not implemented, will initialize synchronously."); } AtlasDbVersion.ensureVersionReported(); return new InMemoryTimestampService(); }
private InMemoryTimestampService getSingletonTimestampService() { if (inMemoryTimestampService == null) { inMemoryTimestampService = new InMemoryTimestampService(); } return inMemoryTimestampService; } }
protected TransactionManager createAndRegisterManager() { InMemoryTimestampService tsService = new InMemoryTimestampService(); TransactionManager manager = SweepTestUtils.setupTxManager(kvs, tsService, tsService, ssm, txService); tmManager.registerTransactionManager(manager); return manager; }
public static TransactionManager setupTxManager(KeyValueService kvs) { InMemoryTimestampService ts = new InMemoryTimestampService(); return setupTxManager( kvs, ts, ts, SweepStrategyManagers.createDefault(kvs), TransactionServices.createForTesting(kvs, ts, false)); }
private TransactionManagers.LockAndTimestampServices getLockAndTimestampServices() { InMemoryTimestampService ts = new InMemoryTimestampService(); return TransactionManagers.createLockAndTimestampServices( metricsManager, config, () -> runtimeConfig, environment, LockServiceImpl::create, () -> ts, () -> ts, invalidator, USER_AGENT); }
private TransactionManagers.LockAndTimestampServices createLockAndTimestampServicesForConfig( AtlasDbConfig atlasDbConfig, AtlasDbRuntimeConfig atlasDbRuntimeConfig) { InMemoryTimestampService ts = new InMemoryTimestampService(); return TransactionManagers.createLockAndTimestampServices( metricsManager, atlasDbConfig, () -> atlasDbRuntimeConfig, environment, LockServiceImpl::create, () -> ts, () -> ts, invalidator, USER_AGENT); } }
@Test public void canFailToInstallNewVersions() { TransactionSchemaManager newManager = createTransactionSchemaManager(new InMemoryTimestampService()); // Always need to seed the default value, if it's not there assertThat(newManager.tryInstallNewTransactionsSchemaVersion(5)).isFalse(); assertThat(newManager.tryInstallNewTransactionsSchemaVersion(5)).isTrue(); }
@Override public TimestampService createTimestampService( KeyValueService rawKvs, Optional<TableReference> unused, boolean initializeAsync) { AtlasDbVersion.ensureVersionReported(); if (initializeAsync) { return AsyncInitializeableInMemoryTimestampService.initializeWhenKvsIsReady(rawKvs); } return new InMemoryTimestampService(); } }
public static CassandraMutationTimestampProvider getMutationProviderWithStartingTimestamp(long timestamp) { InMemoryTimestampService timestampService = new InMemoryTimestampService(); timestampService.fastForwardTimestamp(timestamp); return CassandraMutationTimestampProviders.singleLongSupplierBacked(timestampService::getFreshTimestamp); } }
@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); }
private static TransactionManager createInMemoryTransactionManagerInternal(Set<Schema> schemas) { InMemoryTimestampService ts = new InMemoryTimestampService(); KeyValueService keyValueService = new InMemoryKeyValueService(false);
private AtlasDbServices createMock(KeyValueService kvs) { TimestampService timestampService = new InMemoryTimestampService();
@Before public void setup() { InMemoryTimestampService tsService = new InMemoryTimestampService(); kvs = SweepStatsKeyValueService.create(getKeyValueService(), tsService, () -> AtlasDbConstants.DEFAULT_SWEEP_WRITE_THRESHOLD,
@Test public void canCloseTransactionManagerWithNonCloseableLockService() { InMemoryTimestampService ts = new InMemoryTimestampService(); SnapshotTransactionManager newTransactionManager = new SnapshotTransactionManager( metricsManager, keyValueService, new LegacyTimelockService(ts, closeableLockService, LockClient.of("lock")), ts, mock(LockService.class), // not closeable null, null, null, null, cleaner, false, TransactionTestConstants.GET_RANGES_THREAD_POOL_SIZE, TransactionTestConstants.DEFAULT_GET_RANGES_CONCURRENCY, TimestampCache.createForTests(), MultiTableSweepQueueWriter.NO_OP, executorService, true, () -> ImmutableTransactionConfig.builder().build()); newTransactionManager.close(); // should not throw }
@Before public void setUp() throws Exception { timestampService = new InMemoryTimestampService(); KeyValueService kvs = getBaseKeyValueService(); keyValueServiceWithStats = new StatsTrackingKeyValueService(kvs); keyValueService = spy(new TrackingKeyValueService(keyValueServiceWithStats)); TransactionTables.createTables(kvs); transactionService = TransactionServices.createForTesting(keyValueService, timestampService, false); conflictDetectionManager = ConflictDetectionManagers.createWithoutWarmingCache(keyValueService); sweepStrategyManager = SweepStrategyManagers.createDefault(keyValueService); sweepQueue = spy(TargetedSweeper.createUninitializedForTest(() -> sweepQueueShards)); serializableTxManager = new TestTransactionManagerImpl( metricsManager, keyValueService, timestampService, timestampService, lockClient, lockService, transactionService, conflictDetectionManager, sweepStrategyManager, sweepQueue, MoreExecutors.newDirectExecutorService()); sweepQueue.initialize(serializableTxManager); txManager = new CachingTestTransactionManager(serializableTxManager); }
@Override public TimestampService createTimestampService( KeyValueService rawKvs, Optional<TableReference> unused, boolean initializeAsync) { if (initializeAsync) { log.warn("Asynchronous initialization not implemented, will initialize synchronously."); } AtlasDbVersion.ensureVersionReported(); return new InMemoryTimestampService(); }
InMemoryTimestampService ts = new InMemoryTimestampService(); timestampService = ts; timestampManagementService = ts;
@Before public void setup() { kvs = new InMemoryKeyValueService(true); InMemoryTimestampService tsService = new InMemoryTimestampService(); LockClient lockClient = LockClient.of("sweep client"); lockService = LockServiceImpl.create(LockServerOptions.builder().isStandaloneServer(false).build()); txService = TransactionServices.createForTesting(kvs, tsService, false); Supplier<AtlasDbConstraintCheckingMode> constraints = Suppliers.ofInstance( AtlasDbConstraintCheckingMode.NO_CONSTRAINT_CHECKING); ConflictDetectionManager cdm = ConflictDetectionManagers.createWithoutWarmingCache(kvs); SweepStrategyManager ssm = SweepStrategyManagers.createDefault(kvs); Cleaner cleaner = new NoOpCleaner(); metricsManager = MetricsManagers.createForTests(); TransactionManager transactionManager = SerializableTransactionManager.createForTest( metricsManager, kvs, tsService, tsService, lockClient, lockService, txService, constraints, cdm, ssm, cleaner, AbstractTransactionTest.GET_RANGES_THREAD_POOL_SIZE, AbstractTransactionTest.DEFAULT_GET_RANGES_CONCURRENCY, MultiTableSweepQueueWriter.NO_OP); txManager = transactionManager; }
private void verifyUserAgentOnTimestampAndLockRequests(String timestampPath, String lockPath) { InMemoryTimestampService ts = new InMemoryTimestampService(); TransactionManagers.LockAndTimestampServices lockAndTimestamp = TransactionManagers.createLockAndTimestampServices( metricsManager, config, () -> runtimeConfig, environment, LockServiceImpl::create, () -> ts, () -> ts, invalidator, USER_AGENT); lockAndTimestamp.timelock().getFreshTimestamp(); lockAndTimestamp.timelock().currentTimeMillis(); availableServer.verify(postRequestedFor(urlMatching(timestampPath)) .withHeader(USER_AGENT_HEADER, WireMock.equalTo(USER_AGENT))); availableServer.verify(postRequestedFor(urlMatching(lockPath)) .withHeader(USER_AGENT_HEADER, WireMock.equalTo(USER_AGENT))); }
public static TransactionManager setupTxManager(KeyValueService kvs) { InMemoryTimestampService ts = new InMemoryTimestampService(); return setupTxManager( kvs, ts, ts, SweepStrategyManagers.createDefault(kvs), TransactionServices.createForTesting(kvs, ts, false)); }