RovingStar
RovingStar

Reputation: 13

Cassandra 2.0 Helenus Driver in node.js TTL and TS returned are incorrect

Cassandra version used is 2.0. With Cassandra Helenus Driver, TTL and TS returned don't seem to be correct. Not sure what I am missing here.

Here is the npm installation information:

[email protected] node_modules/cassandra-client
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])

Here is the example

cqlsh:mykeyspace> INSERT INTO users (user_id,  fname, lname)    VALUES (1749, 'john', 'smith5') using TTL 3000;
cqlsh:mykeyspace> SELECT writetime(fname) FROM users;



writetime(fname)
------------------
 1379455363318000
 1379280881300000
 1379280882172000
 1379460416737000

(4 rows)

cqlsh:mykeyspace> SELECT ttl(fname) FROM users;

 ttl(fname)
------------
       null
       null
       null
       2992

(4 rows)

Node.js Snippet

var helenus = require ('helenus');

var conn = new helenus.ConnectionPool({
       host      : 'localhost:9160',
       keyspace   : 'mykeyspace',
       user       : '',
       password   : '',
       timeout    : 3000,
       cqlVersion : '3.0.0'

        //cqlVersion : '3.0.0' // specify this if you're using Cassandra 1.1 and want to use CQL 3
  });

  conn.on('error', function(err){
    console.error(err.name, err.message);
  });

 conn.connect(function(err, keyspace){
    if(err){
      throw(err);
    } else {
        conn.cql("SELECT fname FROM users", function(err, results){
        console.log(err, results);
        console.log('Here we are!');

        results.forEach(function(row){
        //all row of result
           row.forEach(function(name,value,ts,ttl){
           //all column of row
           console.log(name,value,ts,ttl);
          });

         });
      });
    }
 });

Here is the output

Here we are!
fname john Wed Dec 31 1969 16:00:00 GMT-0800 (PST) null
fname john Wed Dec 31 1969 16:00:00 GMT-0800 (PST) null
fname john Wed Dec 31 1969 16:00:00 GMT-0800 (PST) null
fname john Wed Dec 31 1969 16:00:00 GMT-0800 (PST) null

Upvotes: 1

Views: 769

Answers (1)

Alex Popescu
Alex Popescu

Reputation: 4002

Pretty much everything I'm reading on the Helenus project page makes me think that it's not compatible with Apache Cassandra 2.0/CQL3

To exemplify:

Since 0.14.1, the client supports Apache Cassandra 1.2.x in CQL 2 compatibility mode.

By default Cassandra 1.2.x uses CQL 3 so you need to turn the CQL 2 compatibility mode on by passing 'cql_version': '2.0.0' attribute to Connection / PooledConnection constructor in the options object.

and

If you use cqlsh which ships with Cassandra 1.2.x or a newer version of cqlsh which defaults to CQL 3 you need to pass -2 argument to it, otherwise the client won't be able to read column family definitions (#67).

Upvotes: 1

Related Questions