use of com.palantir.atlasdb.keyvalue.cassandra.CassandraKeyValueService 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.keyvalue.cassandra.CassandraKeyValueService in project atlasdb by palantir.
the class NodesDownTestSetup method setupTestTable.
private static void setupTestTable() {
CassandraKeyValueService setupDb = createCassandraKvs();
setupDb.createTable(TEST_TABLE, AtlasDbConstants.GENERIC_TABLE_METADATA);
setupDb.put(TEST_TABLE, ImmutableMap.of(CELL_1_1, PtBytes.toBytes("old_value")), OLD_TIMESTAMP);
setupDb.put(TEST_TABLE, ImmutableMap.of(CELL_1_1, DEFAULT_CONTENTS), DEFAULT_TIMESTAMP);
setupDb.put(TEST_TABLE, ImmutableMap.of(CELL_1_2, DEFAULT_CONTENTS), DEFAULT_TIMESTAMP);
setupDb.put(TEST_TABLE, ImmutableMap.of(CELL_2_1, DEFAULT_CONTENTS), DEFAULT_TIMESTAMP);
setupDb.createTable(TEST_TABLE_TO_DROP, AtlasDbConstants.GENERIC_TABLE_METADATA);
setupDb.createTable(TEST_TABLE_TO_DROP_2, AtlasDbConstants.GENERIC_TABLE_METADATA);
setupDb.close();
}
Aggregations