I am creating a cassandra session object for my application and creating few prepared statements for it. Setting different consistency levels on each prepared statement.
statement1 = session.prepare("SELECT key FROM foo WHERE key = ?");
statement1.setConsistencyLevel(ConsistencyLevel.LOCAL_QUORUM);
statement2 = session.prepare("SELECT key FROM foo WHERE key = ?");
statement2.setConsistencyLevel(ConsistencyLevel.QUORUM);
we only had statement1 before, cassandra read latency was less than 10 ms. when we added statement2 and started using it from one part of the code, latency increased to 250 ms for every cassandra calls.
Is this a bug in datastax? Is it possible that
statement2.setConsistencyLevel(ConsistencyLevel.QUORUM);
is setting consistency level to ConsistencyLevel.QUORUM
for entire session?
Am I missing something silly?
I am using cassandra-driver-core-3.1.3.jar
setConsistencyLevel
also returns statement object, can you change tostatement1 = session.prepare("SELECT key FROM foo WHERE key = ?").setConsistencyLevel(ConsistencyLevel.LOCAL_QUORUM)
– sayborasone
query might update consistency level forall
queries of the same session. – sayboras