The level of consistency is ALL used while the operator has a level of consistency defined by two

We use the java datastax cassandra driver 2.1.2. The version of Cassandra we use 2.0.9.

We have an operator that we build with QueryBuilder, and we explicitly indicate the level of consistency on the operator on TWO.

Select selectStatement =  QueryBuilder.select().from(ARTICLES);
selectStatement.where(eq(ORGANIZATION_ID, organizationId));
selectStatement.setConsistencyLevel(ConsistencyLevel.TWO);

final ResultSet rs = session.execute(selectStatement);
//call to all() will be removed since it is enough to iterate over result set 
//and then you get pagination for free instead of loading everything in 
//memory
List<Row> rows = rs.all();  
for (final Row row : rows) {
   //do something with Row, convert to POJO
}

We get an exception like this:

com.datastax.driver.core.exceptions.ReadTimeoutException: Cassandra timeout during read query at consistency ALL (3 responses were required but only 2 replica responded)
com.datastax.driver.core.exceptions.ReadTimeoutException.copy (ReadTimeoutException.java:69)
com.datastax.driver.core.DefaultResultSetFuture.extractCauseFromExecutionException (DefaultResultSetFuture.java:259)
com.datastax.driver.core.ArrayBackedResultSet$MultiPage.prepareNextRow (ArrayBackedResultSet.java:279)
com.datastax.driver.core.ArrayBackedResultSet$MultiPage.isExhausted (ArrayBackedResultSet.java:239)
com.datastax.driver.core.ArrayBackedResultSet$1.hasNext (ArrayBackedResultSet.java:122)
com.datastax.driver.core.ArrayBackedResultSet.all (ArrayBackedResultSet.java:111)

I know that a call all()to ResultSetforces you to load all the articles for the organization into memory and work with it and creates a load on cassandra. This will be deleted as indicated in the comments. This may lead to a read timeout, but I'm still puzzled why there is an error in the error message ALL.

, , ALL , TWO . all() - CL ALL ?

+4

All Articles