Search in sources :

Example 1 with CDCWriteException

use of org.apache.cassandra.exceptions.CDCWriteException in project cassandra by apache.

the class CommitLogSegmentManagerCDCTest method bulkWrite.

private void bulkWrite(String tableName, int mutationSize) throws Throwable {
    TableMetadata ccfm = Keyspace.open(keyspace()).getColumnFamilyStore(tableName).metadata();
    boolean blockWrites = DatabaseDescriptor.getCDCBlockWrites();
    // Spin to make sure we hit CDC capacity
    try {
        for (int i = 0; i < 1000; i++) {
            new RowUpdateBuilder(ccfm, 0, i).add("data", randomizeBuffer(mutationSize)).build().applyFuture().get();
        }
        if (blockWrites)
            Assert.fail("Expected CDCWriteException from full CDC but did not receive it.");
    } catch (CDCWriteException e) {
        if (!blockWrites)
            Assert.fail("Excepted no CDCWriteException when not blocking writes but received it.");
    }
}
Also used : TableMetadata(org.apache.cassandra.schema.TableMetadata) CDCWriteException(org.apache.cassandra.exceptions.CDCWriteException) RowUpdateBuilder(org.apache.cassandra.db.RowUpdateBuilder)

Aggregations

RowUpdateBuilder (org.apache.cassandra.db.RowUpdateBuilder)1 CDCWriteException (org.apache.cassandra.exceptions.CDCWriteException)1 TableMetadata (org.apache.cassandra.schema.TableMetadata)1