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

Stefan Podkowinski commented on CASSANDRA-9620:
-----------------------------------------------

I think this happens in case the coordinator got a timeout while trying to 
write the batch log. Writing the batch log will always be done using CL ONE. 
This can be verified by checking the {{writeType}} flag in the exception which 
should be {{BATCH_LOG}} in your error case. 


> 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