Serial consistency issue

413 views
Skip to first unread message

Silviu Butnariu

unread,
May 25, 2018, 10:24:44 AM5/25/18
to DataStax PHP Driver for Apache Cassandra User Mailing List
Hi guys,

Having the following configuration: 3 nodes, RF=2, when executing a LWT query with CL=one (no serial consistency manually set) if one of the nodes is down (basically have 2 out of 3 nodes up) I get this error: SERIAL is not supported as conditional update commit consistency. Use ANY if you mean \"make sure it is accepted but I don't care how many replicas commit it for non-SERIAL reads\

It's similar to what error you'd get when setting serial consistency values to the consistency field - but i do set consistency one, not serial.

Some code, for context:

$clusterBuilder = new Builder();
$clusterBuilder
->withDefaultConsistency(\Cassandra::CONSISTENCY_ONE)
->withDefaultPageSize(1000)
->withContactPoints('node1, node2, node3')//node3 is down
->withPort(6666)
->withTokenAwareRouting(true)
->withConnectTimeout(5)
->withRequestTimeout(5)
->withPersistentSessions(true)
->withRoundRobinLoadBalancingPolicy()
->withCredentials('test', 'test');
$cluster = $clusterBuilder->build();
$session = $cluster->connect('mykeyspace');
$statement = new \Cassandra\SimpleStatement(
"UPDATE mykeyspace.my_table SET field1 = true WHERE field2 = false IF EXISTS");
$future = $session->executeAsync($statement);
$result = $future->get();
//this code(under the given conditions - 1 node down) gives the error above.

Even if i manually set consistency and serial_consistency via execution options, the same error appears.

$options = new \Cassandra\ExecutionOptions(array(
'consistency' => \Cassandra::CONSISTENCY_ONE,
'serial_consistency' => \Cassandra::CONSISTENCY_SERIAL
));
$future = $session->executeAsync($statement, $options);
$result = $future->get();

If all nodes are up, everything works as expected.
The issue seems similar to the one described here: https://issues.apache.org/jira/browse/CASSANDRA-10785
Could it be a driver problem, or am I missing something?

Thanks,
Silviu

Michael Penick

unread,
Jun 5, 2018, 11:32:54 AM6/5/18
to php-dri...@lists.datastax.com
Before we dig into this. What versions of the php-driver and cpp-driver are you using?

Mike


Could it be a driver problem, or am I missing something?

Thanks,
Silviu

--
You received this message because you are subscribed to the Google Groups "DataStax PHP Driver for Apache Cassandra User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to php-driver-user+unsubscribe@lists.datastax.com.

Michael Penick

unread,
Jun 5, 2018, 12:22:20 PM6/5/18
to php-dri...@lists.datastax.com
SERIAL and LOCAL_SERIAL are not supported by writes. Those consistencies should only be used for reads.

I was able to reproduce the "SERIAL is not supported as conditional update commit consistency..." error using cqlsh on a 3 node cluster:

cqlsh> CREATE KEYSPACE IF NOT EXISTS cycling  WITH REPLICATION = {    'class' : 'NetworkTopologyStrategy',    'dc1' : 2};
cqlsh> CREATE TYPE cycling.fullname ( firstname text, lastname text );
cqlsh> CREATE TABLE cycling.race_winners (race_name text, race_position int, cyclist_name FROZEN<fullname>, PRIMARY KEY (race_name, race_position));
cqlsh> INSERT INTO cycling.race_winners (race_name, race_position, cyclist_name) VALUES ('a', 1, {firstname:'mike',lastname:'p'});
cqlsh> CONSISTENCY SERIAL ;
cqlsh> UPDATE cycling.race_winners SET cyclist_name = {firstname:'mike',lastname:'q'} WHERE race_name = 'a' AND race_position = 1 IF EXISTS;
InvalidRequest: Error from server: code=2200 [Invalid query] message="SERIAL is not supported as conditional update commit consistency. Use ANY if you mean "make sure it is accepted but I don't care how many replicas commit it for non-SERIAL reads""

Note: All 3 nodes are up.

Mike





Silviu Butnariu

unread,
Jun 8, 2018, 3:40:18 PM6/8/18
to DataStax PHP Driver for Apache Cassandra User Mailing List
Hi Michael,

datastax/php-driver version is 1.2.2.

Yes, from cqlsh it all makes sense: if one sets CL=SERIAL and runs update query, it crashes. Thing is, I'm NOT setting CL to SERIAL, as highlighted in my snippet(I set CL to ONE), and I still get this error.

Thanks,
Silviu

regis le bretonnic

unread,
Jun 22, 2018, 9:29:48 AM6/22/18
to DataStax PHP Driver for Apache Cassandra User Mailing List
Hi Mickael

Thank for the answer. I work with Silviu and we think to have an explaination. It is globally a misunderstanding of how serial consistency works. To be honest, it is not very well explained.

The issue occured on our dev cluster that is a small one (3 nodes and RF=2). The serial CL seems to operate not on all nodes but on nodes that own data.

With RF=2 and 1 node down, we can not reach SERIAL on 66% of our LWT. Increasing RF to 3 solves everything.

What I learnt with our tests is that SERIAL CL operates on surviving servers that owns data and not on just surviving data.

Thread can be closed.
> To unsubscribe from this group and stop receiving emails from it, send an email to php-driver-us...@lists.datastax.com.

Reply all
Reply to author
Forward
0 new messages