Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change Helenus Consistency Level in CQL query

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.

like image 980
Elisiário Couto Avatar asked Mar 22 '13 14:03

Elisiário Couto


Video Answer


2 Answers

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.

like image 200
Richard Avatar answered Sep 20 '22 00:09

Richard


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

like image 39
Luis González Avatar answered Sep 22 '22 00:09

Luis González