Cassandra - cqlsh returns inconsistent results even if CONSISTENCY LEVEL is set to ALL or QUORUM

I have a Cassandra cluster with 4 nodes. I have a keyspace with a replication factor of 3.

Here are examples of cqlsh results that I get when I do "select count (*) on a particular table. The results invariably differ even if the consistency level is set to ALL or QUORUM."


cqlsh: test> CONSISTENCY all

The consistency level is set to ALL.

cqlsh: test> select count (*) from article;

count

28620 (1 line)

cqlsh: test> select count (*) from article;

count

28703 (1 line)

cqlsh: test> select count (*) from article;

count

28046 (1 line)

cqlsh: test> CONSISTENCY QUORUM

The consistency level is set to QUORUM.

cqlsh: test> select count (*) from article;

count

28612 (1 line)

cqlsh: test> select count (*) from article;

count

28122 (1 line)

cqlsh: test>


+3


source to share


2 answers


I think this is a bug that may have been fixed in version 2.1.6.

Check out this ticket:



CASSANDRA-8940

Are you using an earlier version than 2.1.6?

+2


source


Well, actually, I think this might be the way cqlsh works. From http://docs.datastax.com/en/cql/3.1/cql/cql_reference/select_r.html

SELECT COUNT(*) FROM big_table LIMIT 50000;
SELECT COUNT(*) FROM big_table LIMIT 200000;

      



The result of these statements, if there were 105,291 rows in the database, would be: 50,000 and 105,291. The cqlsh shell has a default limit of 10,000. The Cassandra server and proprietary protocol do not limit the number of rows that can be returned, although the timeout will terminate queries to protect against invalid queries that can cause system instability.

Try cqlsh: test> select count (*) from article LIMIT 200000; or other great value

+1


source







All Articles