Reputation: 1611
I have 6 node cluster with replication factor 3. I am using normal consistency level as QUORUM and serial consistency level as SERIAL.
I have a conditional write query (IF EXIST). What will happen if I set both normal and serial to this statement using datastax java driver like below.
//preparedStatement has a conditional query.
BoundStatement boundStatement = new BoundStatement(preparedStatement);
boundStatement.setSerialConsistencyLevel(ConsistencyLevel.SERIAL);
//is this required??
boundStatement.setConsistencyLevel(ConsistencyLevel.QUORUM);
My queries:
I referred to below link but it does not explain much https://docs.datastax.com/en/cassandra/3.x/cassandra/dml/dmlConfigSerialConsistency.html
The learn phase, which defines what read operations will be guaranteed to complete immediately if lightweight writes are occurring uses a normal consistency level.
Please explain in simple terms.
Upvotes: 4
Views: 702
Reputation: 4536
The serial consistency level is only used for the Paxos phase of a lightweight transaction. If that phase succeeds, then the actual mutation (read or write) will take place using the "normal" consistency level specified.
So to answer your questions:
Will the normal consistency QUORUM will be ignored OR it will be taken into account ?
It will be taken into account if the lightweight transaction succeeds and the mutation is performed.
Should I set only serial consistency level in this case ?
Every statement carries a consistency level. If you don't specify anything at statement level, the defaults defined at cluster level apply.
Upvotes: 7