[ 
https://issues.apache.org/jira/browse/CASSANDRA-9620?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14593277#comment-14593277
 ] 

Jorge Bay commented on CASSANDRA-9620:
--------------------------------------

You are right, it is for the batch log.

Maybe it would be a good idea to adjust the error message (either on Cassandra 
side or at driver level) to let users know that what failed was the initial 
batch log write as the current message can cause the user to understand that 
they are not sending the correct consistency level.

> Write timeout error for batch request gives wrong consistency
> -------------------------------------------------------------
>
>                 Key: CASSANDRA-9620
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-9620
>             Project: Cassandra
>          Issue Type: Bug
>            Reporter: Jorge Bay
>
> In case there is a write time out error when executing a batch with a 
> consistency higher than ONE, error information returned is incorrect:
> {{"Cassandra timeout during write query at consistency ONE (0 replica(s) 
> acknowledged the write over 1 required"}}
> *Consistency is always ONE and required acks is always 1*.
> To reproduce (pseudo-code):
> {code:java}
> //create a 2 node cluster
> createTwoNodeCluster();
> var session = cluster.connect();
> session.execute("create keyspace ks1 WITH replication = {'class': 
> 'SimpleStrategy', 'replication_factor' : 2}");
> session.execute("create table ks1.tbl1 (k text primary key, i int)");
> session.execute(new SimpleStatement("INSERT INTO ks1.tbl1 (k, i) VALUES 
> ('one', 1)").setConsistencyLevel(ConsistencyLevel.ALL));
> //Stop the second node
> stopNode2();
> var batch = new BatchStatement();
> batch.add(new SimpleStatement("INSERT INTO ks1.tbl1 (k, i) VALUES ('two', 
> 2)"));
> batch.add(new SimpleStatement("INSERT INTO ks1.tbl1 (k, i) VALUES ('three', 
> 3)"));
> //This line will throw a WriteTimeoutException with a wrong consistency
> //Caused by an error response from Cassandra
> session.execute(batch.setConsistencyLevel(ConsistencyLevel.ALL));
> {code}
> Wrong error information could affect driver retry policies.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to