Search in sources :

Example 11 with JavaDriverClient

use of org.apache.cassandra.stress.util.JavaDriverClient in project cassandra by apache.

the class SettingsCommand method truncateTables.

protected void truncateTables(StressSettings settings, String ks, String... tables) {
    JavaDriverClient client = settings.getJavaDriverClient(false);
    assert settings.command.truncate != SettingsCommand.TruncateWhen.NEVER;
    for (String table : tables) {
        String cql = String.format("TRUNCATE %s.%s", ks, table);
        client.execute(cql, org.apache.cassandra.db.ConsistencyLevel.ONE);
    }
    System.out.println(String.format("Truncated %s.%s. Sleeping %ss for propagation.", ks, Arrays.toString(tables), settings.node.nodes.size()));
    Uninterruptibles.sleepUninterruptibly(settings.node.nodes.size(), TimeUnit.SECONDS);
}
Also used : JavaDriverClient(org.apache.cassandra.stress.util.JavaDriverClient)

Aggregations

JavaDriverClient (org.apache.cassandra.stress.util.JavaDriverClient)11 com.datastax.driver.core (com.datastax.driver.core)2 AlreadyExistsException (com.datastax.driver.core.exceptions.AlreadyExistsException)2 EncryptionOptions (org.apache.cassandra.config.EncryptionOptions)2 ColumnMetadata (org.apache.cassandra.schema.ColumnMetadata)2 CharacterCodingException (java.nio.charset.CharacterCodingException)1 CASQuery (org.apache.cassandra.stress.operations.userdefined.CASQuery)1 SchemaInsert (org.apache.cassandra.stress.operations.userdefined.SchemaInsert)1 SchemaQuery (org.apache.cassandra.stress.operations.userdefined.SchemaQuery)1 ValidatingSchemaQuery (org.apache.cassandra.stress.operations.userdefined.ValidatingSchemaQuery)1