use of com.palantir.atlasdb.cassandra.CassandraKeyValueServiceConfig in project atlasdb by palantir.
the class HeartbeatServiceIntegrationTest method setUp.
@Before
public void setUp() throws TException {
queryRunner = new TracingQueryRunner(log, TracingPrefsConfig.create());
CassandraKeyValueServiceConfig config = CassandraContainer.KVS_CONFIG;
writeConsistency = ConsistencyLevel.EACH_QUORUM;
clientPool = CassandraClientPoolImpl.create(config);
lockTable = new UniqueSchemaMutationLockTable(new SchemaMutationLockTables(clientPool, config), LockLeader.I_AM_THE_LOCK_LEADER);
heartbeatService = new HeartbeatService(clientPool, queryRunner, heartbeatTimePeriodMillis, lockTable.getOnlyTable(), writeConsistency);
lockTestTools = new SchemaMutationLockTestTools(clientPool, lockTable);
lockTestTools.setLocksTableValue(lockId, 0);
}
use of com.palantir.atlasdb.cassandra.CassandraKeyValueServiceConfig in project atlasdb by palantir.
the class CassandraSchemaLockTest method shouldCreateTablesConsistentlyWithMultipleCassandraNodes.
@Test
public void shouldCreateTablesConsistentlyWithMultipleCassandraNodes() throws Exception {
TableReference table1 = TableReference.createFromFullyQualifiedName("ns.table1");
CassandraKeyValueServiceConfig config = ThreeNodeCassandraCluster.KVS_CONFIG;
try {
CyclicBarrier barrier = new CyclicBarrier(THREAD_COUNT);
for (int i = 0; i < THREAD_COUNT; i++) {
async(() -> {
CassandraKeyValueService keyValueService = CassandraKeyValueServiceImpl.create(config, Optional.empty());
barrier.await();
keyValueService.createTable(table1, AtlasDbConstants.GENERIC_TABLE_METADATA);
return null;
});
}
} finally {
executorService.shutdown();
assertTrue(executorService.awaitTermination(4, TimeUnit.MINUTES));
}
CassandraKeyValueService kvs = CassandraKeyValueServiceImpl.create(config, Optional.empty());
assertThat(kvs.getAllTableNames(), hasItem(table1));
assertThat(new File(CONTAINERS.getLogDirectory()), containsFiles(everyItem(doesNotContainTheColumnFamilyIdMismatchError())));
}
use of com.palantir.atlasdb.cassandra.CassandraKeyValueServiceConfig in project atlasdb by palantir.
the class QosCassandraEteTestSetup method getAtlasDbConfig.
private static AtlasDbConfig getAtlasDbConfig() {
DockerPort cassandraPort = docker.containers().container("cassandra").port(CASSANDRA_PORT_NUMBER);
InetSocketAddress cassandraAddress = new InetSocketAddress(cassandraPort.getIp(), cassandraPort.getExternalPort());
CassandraKeyValueServiceConfig kvsConfig = ImmutableCassandraKeyValueServiceConfig.builder().servers(ImmutableList.of(cassandraAddress)).credentials(ImmutableCassandraCredentialsConfig.builder().username("cassandra").password("cassandra").build()).ssl(false).replicationFactor(1).autoRefreshNodes(false).build();
return ImmutableAtlasDbConfig.builder().namespace("qosete").keyValueService(kvsConfig).initializeAsync(true).build();
}
use of com.palantir.atlasdb.cassandra.CassandraKeyValueServiceConfig in project atlasdb by palantir.
the class CleanCassLocksStateCommand method getCassandraKvsConfig.
private CassandraKeyValueServiceConfig getCassandraKvsConfig() {
KeyValueServiceConfig kvsConfig = getAtlasDbConfig().keyValueService();
if (!kvsConfig.type().equals(CassandraKeyValueServiceConfig.TYPE)) {
throw new IllegalStateException(String.format("KeyValueService must be of type %s, but yours is %s", CassandraKeyValueServiceConfig.TYPE, kvsConfig.type()));
}
CassandraKeyValueServiceConfig cassandraConfig = (CassandraKeyValueServiceConfig) kvsConfig;
Optional<String> namespace = getAtlasDbConfig().namespace();
String desiredKeyspace = OptionalResolver.resolve(namespace, cassandraConfig.keyspace());
return CassandraKeyValueServiceConfigs.copyWithKeyspace(cassandraConfig, desiredKeyspace);
}
use of com.palantir.atlasdb.cassandra.CassandraKeyValueServiceConfig in project atlasdb by palantir.
the class CleanCassLocksStateCommand method call.
@Override
public Integer call() throws Exception {
Preconditions.checkState(isOffline(), "This CLI can only be run offline");
CassandraKeyValueServiceConfig config = getCassandraKvsConfig();
return runWithConfig(config);
}
Aggregations