I'm doing some tests with Cassandra and its Node.JS Driver, Helenus. Is there any way to change the Consistency Level of a query, using CQL?
Helenus documentation only shows an example of doing this using the Helenus Thrift connector, but I want to use the CQL connector.
I tried to query Cassandra like this
conn.cql(cqlRead, vals, {ConsistencyLevel:ANY, gzip:true}, cb);
but node threw this error
ReferenceError: ANY is not defined
Then, I changed 'ANY' to '1' and node ran the code, but I didn't noticed any difference.
The problem is you can't use CL.ANY for reads, only for writes. ANY means count a commit log write as success, even if none of the replicas are available. Since commit logs aren't readable by queries it doesn't make sense to use CL.ANY for reads so Cassandra won't let you.
I have seen the Helenus documentation and they set the consistency that way
cf.get('foo', {consistency:helenus.ConsistencyLevel.ONE}, function(err, row){
// Your code here
})
Have you tried with consistency:helenus.ConsistencyLevel.ANY. I think that you probably get another different than ReferenceError
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With