use of com.instaclustr.esop.impl.interaction.CassandraSchemaVersion in project esop by instaclustr.
the class ManifestTest method createTable.
private void createTable(String keyspace, String table) throws Exception {
String currentVersion = new CassandraSchemaVersion(jmx).act();
Thread.sleep(3000);
session.execute(createKeyspace(keyspace).ifNotExists().withNetworkTopologyStrategy(of("datacenter1", 1)).build());
Thread.sleep(5000);
session.execute(SchemaBuilder.createTable(keyspace, table).ifNotExists().withPartitionKey(ID, TEXT).withClusteringColumn(DATE, TIMEUUID).withColumn(NAME, TEXT).build());
waitUntilSchemaChange(currentVersion);
}
use of com.instaclustr.esop.impl.interaction.CassandraSchemaVersion in project esop by instaclustr.
the class CassandraClusterTopology method act.
@Override
public ClusterTopology act() throws Exception {
final String clusterName = new CassandraClusterName(cassandraJMXService).act();
// map of endpoints and host ids
final Map<InetAddress, UUID> endpoints = new CassandraEndpoints(cassandraJMXService).act();
// map of endpoints and dc they belong to
final Map<InetAddress, String> endpointDcs = new CassandraEndpointDC(cassandraJMXService, endpoints.keySet()).act();
// map of endpoints and hostnames
final Map<InetAddress, String> hostnames = new CassandraHostname(endpoints.keySet()).act();
// map of endpoints and rack they belong to
final Map<InetAddress, String> endpointRacks = new CassandraEndpointRack(cassandraJMXService, endpoints.keySet()).act();
final String schemaVersion = new CassandraSchemaVersion(cassandraJMXService).act();
final ClusterTopology resolvedTopology = constructTopology(clusterName, endpoints, endpointDcs, hostnames, endpointRacks, schemaVersion);
final Set<String> invalidDcs = ClusterTopology.sanitizeDcs(dcs).stream().filter(dc -> !resolvedTopology.getDcs().contains(dc)).collect(toSet());
if (!invalidDcs.isEmpty()) {
throw new IllegalStateException(format("Some DCs to filter on do not exist: %s, existing: %s", invalidDcs, String.join(",", resolvedTopology.getDcs())));
}
logger.info(resolvedTopology.toString());
return resolvedTopology;
}
Aggregations