use of com.palantir.atlasdb.transaction.impl.SerializableTransactionManager in project atlasdb by palantir.
the class TimeLockServerDownIntegrationTest method getsDependencyExceptionFromTransactionsWhenDown.
@Test
public void getsDependencyExceptionFromTransactionsWhenDown() {
SerializableTransactionManager txnManager = TimeLockTestUtils.createTransactionManager(CLUSTER);
txnManager.getKeyValueService().createTable(TABLE, AtlasDbConstants.GENERIC_TABLE_METADATA);
// write a value
txnManager.runTaskWithRetry(txn -> {
txn.put(TABLE, ImmutableMap.of(CELL, DATA));
return null;
});
// read the value
byte[] retrievedData = txnManager.runTaskWithRetry(txn -> txn.get(TABLE, ImmutableSet.of(CELL)).get(CELL));
assertThat(retrievedData).isEqualTo(DATA);
takeDownTimeLock();
// Try to get again
assertThatThrownBy(() -> txnManager.runTaskWithRetry(txn -> txn.get(TABLE, ImmutableSet.of(CELL)).get(CELL))).isExactlyInstanceOf(AtlasDbDependencyException.class);
}
use of com.palantir.atlasdb.transaction.impl.SerializableTransactionManager in project atlasdb by palantir.
the class TimeLockTestUtils method createTransactionManager.
static SerializableTransactionManager createTransactionManager(TestableTimelockCluster cluster) {
List<String> serverUris = cluster.servers().stream().map(server -> server.serverHolder().getTimelockUri()).collect(Collectors.toList());
AtlasDbConfig config = ImmutableAtlasDbConfig.builder().namespace("test").keyValueService(new InMemoryAtlasDbConfig()).timelock(ImmutableTimeLockClientConfig.builder().serversList(ImmutableServerListConfig.builder().servers(serverUris).sslConfiguration(SslConfiguration.of(Paths.get("var/security/trustStore.jks"))).build()).build()).build();
return TransactionManagers.builder().config(config).userAgent("test").globalMetricsRegistry(new MetricRegistry()).globalTaggedMetricRegistry(DefaultTaggedMetricRegistry.getDefault()).build().serializable();
}
use of com.palantir.atlasdb.transaction.impl.SerializableTransactionManager in project atlasdb by palantir.
the class AtlasDbServiceImplTest method setUp.
@Before
public void setUp() {
kvs = mock(KeyValueService.class);
SerializableTransactionManager txManager = mock(SerializableTransactionManager.class);
TableMetadataCache metadataCache = mock(TableMetadataCache.class);
atlasDbService = new AtlasDbServiceImpl(kvs, txManager, metadataCache);
}
use of com.palantir.atlasdb.transaction.impl.SerializableTransactionManager in project atlasdb by palantir.
the class SweepTestUtils method setupTxManager.
public static SerializableTransactionManager setupTxManager(KeyValueService kvs, TimestampService tsService, SweepStrategyManager ssm, TransactionService txService) {
LockClient lockClient = LockClient.of("sweep client");
LockService lockService = LockServiceImpl.create(LockServerOptions.builder().isStandaloneServer(false).build());
Supplier<AtlasDbConstraintCheckingMode> constraints = () -> AtlasDbConstraintCheckingMode.NO_CONSTRAINT_CHECKING;
ConflictDetectionManager cdm = ConflictDetectionManagers.createWithoutWarmingCache(kvs);
Cleaner cleaner = new NoOpCleaner();
SerializableTransactionManager txManager = 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, InMemorySweepQueue.writer());
setupTables(kvs);
return txManager;
}
use of com.palantir.atlasdb.transaction.impl.SerializableTransactionManager 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;
}
Aggregations