You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Jorge Bay (JIRA)" <ji...@apache.org> on 2015/06/19 11:14:00 UTC

[jira] [Created] (CASSANDRA-9620) Write timeout error for batch request gives wrong consistency

Jorge Bay created CASSANDRA-9620:
------------------------------------

             Summary: 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)