Search in sources :

Example 16 with KeyspaceMetadata

use of com.datastax.oss.driver.api.core.metadata.schema.KeyspaceMetadata in project zipkin by openzipkin.

the class Schema method readMetadata.

static Metadata readMetadata(CqlSession session, String keyspace) {
    KeyspaceMetadata keyspaceMetadata = ensureKeyspaceMetadata(session, keyspace);
    Map<String, String> replication = keyspaceMetadata.getReplication();
    if ("SimpleStrategy".equals(replication.get("class"))) {
        if ("1".equals(replication.get("replication_factor"))) {
            LOG.warn("running with RF=1, this is not suitable for production. Optimal is 3+");
        }
    }
    boolean hasAutocompleteTags = hasUpgrade1_autocompleteTags(keyspaceMetadata);
    if (!hasAutocompleteTags) {
        LOG.warn("schema lacks autocomplete indexing: apply {}, or set CassandraStorage.ensureSchema=true", UPGRADE_1);
    }
    boolean hasRemoteService = hasUpgrade2_remoteService(keyspaceMetadata);
    if (!hasRemoteService) {
        LOG.warn("schema lacks remote service indexing: apply {}, or set CassandraStorage.ensureSchema=true", UPGRADE_2);
    }
    return new Metadata(hasAutocompleteTags, hasRemoteService);
}
Also used : KeyspaceMetadata(com.datastax.oss.driver.api.core.metadata.schema.KeyspaceMetadata) Resources.resourceToString(zipkin2.storage.cassandra.internal.Resources.resourceToString) KeyspaceMetadata(com.datastax.oss.driver.api.core.metadata.schema.KeyspaceMetadata)

Aggregations

KeyspaceMetadata (com.datastax.oss.driver.api.core.metadata.schema.KeyspaceMetadata)16 Test (org.junit.jupiter.api.Test)9 Metadata (com.datastax.oss.driver.api.core.metadata.Metadata)7 TableMetadata (com.datastax.oss.driver.api.core.metadata.schema.TableMetadata)5 Statement (com.datastax.oss.driver.api.core.cql.Statement)4 KeyColumnValueStoreTest (org.janusgraph.diskstorage.KeyColumnValueStoreTest)4 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)4 CqlSession (com.datastax.oss.driver.api.core.CqlSession)3 Node (com.datastax.oss.driver.api.core.metadata.Node)3 Test (org.junit.Test)2 UdtValue (com.datastax.oss.driver.api.core.data.UdtValue)1 MutableCodecRegistry (com.datastax.oss.driver.api.core.type.codec.registry.MutableCodecRegistry)1 Resources.resourceToString (zipkin2.storage.cassandra.internal.Resources.resourceToString)1