Search in sources :

Example 1 with InvalidQueryException

use of com.datastax.oss.driver.api.core.servererrors.InvalidQueryException in project zipkin by openzipkin.

the class CassandraStorageExtension method clear.

void clear(CassandraStorage storage) {
    // Clear any key cache
    CassandraSpanConsumer spanConsumer = storage.spanConsumer;
    if (spanConsumer != null)
        spanConsumer.clear();
    CqlSession session = storage.session.session;
    if (session == null)
        session = globalSession;
    List<String> toTruncate = new ArrayList<>(SEARCH_TABLES);
    toTruncate.add(TABLE_DEPENDENCY);
    toTruncate.add(TABLE_SPAN);
    for (String table : toTruncate) {
        try {
            session.execute("TRUNCATE " + storage.keyspace + "." + table);
        } catch (InvalidQueryException e) {
            assertThat(e).hasMessage("unconfigured table " + table);
        }
    }
    blockWhileInFlight(storage);
}
Also used : ArrayList(java.util.ArrayList) CqlSession(com.datastax.oss.driver.api.core.CqlSession) InvalidQueryException(com.datastax.oss.driver.api.core.servererrors.InvalidQueryException)

Aggregations

CqlSession (com.datastax.oss.driver.api.core.CqlSession)1 InvalidQueryException (com.datastax.oss.driver.api.core.servererrors.InvalidQueryException)1 ArrayList (java.util.ArrayList)1