Skip to content
This repository has been archived by the owner on Feb 22, 2019. It is now read-only.

HelenusInvalidRequestException: cannot parse '0' as hex bytes #108

Closed
tristanls opened this issue Jun 6, 2013 · 2 comments
Closed

HelenusInvalidRequestException: cannot parse '0' as hex bytes #108

tristanls opened this issue Jun 6, 2013 · 2 comments

Comments

@tristanls
Copy link
Contributor

Versions and setup:

helenus@0.6.2

$ cassandra -v
1.2.5
$ cqlsh --version
cqlsh 3.0.2
cqlsh> create keyspace foo with replication = { 'class': 'SimpleStrategy', 'replication_factor' : 1 };
cqlsh> use foo;
cqlsh:foo> create table foos (foo text, column text, value double, primary key (foo, column));

In helenus:

var pool = new helenus.ConnectionPool({
  hosts: ["localhost:9160"],
  keyspace: "foo"
});

pool.connect(function (error) {
  if (error) return explode("!");
  pool.cql("INSERT INTO foos (foo, column, value) VALUES (?, ?, ?);", ['foo.bar.baz', '1370528287:170164551', 0], function (error) {
    console.dir(error);
    console.error(stack.error);
  });
});

The above results in:

HelenusInvalidRequestException: cannot parse '0' as hex bytes

:/

@tristanls
Copy link
Contributor Author

Here is a more precise (copy and pasteable) demonstration of the bug:

$ cassandra -v
1.2.5

cqlsh path

$ cqlsh --version
cqlsh 3.0.2
cqlsh> describe keyspaces;

system  system_auth  system_traces

cqlsh> create keyspace foo with replication = { 'class': 'SimpleStrategy', 'replication_factor' : 1 };
cqlsh> use foo;
cqlsh:foo> create table foos (foo text, column text, value double, primary key (foo, column));
cqlsh:foo> desc table foos;

CREATE TABLE foos (
  foo text,
  column text,
  value double,
  PRIMARY KEY (foo, column)
) WITH
  bloom_filter_fp_chance=0.010000 AND
  caching='KEYS_ONLY' AND
  comment='' AND
  dclocal_read_repair_chance=0.000000 AND
  gc_grace_seconds=864000 AND
  read_repair_chance=0.100000 AND
  replicate_on_write='true' AND
  populate_io_cache_on_flush='false' AND
  compaction={'class': 'SizeTieredCompactionStrategy'} AND
  compression={'sstable_compression': 'SnappyCompressor'};

cqlsh:foo> select * from foos;
cqlsh:foo> INSERT INTO foos (foo, column, value) VALUES ('foo.bar.baz', '1370528287:170164551', 0);
cqlsh:foo> select * from foos;

 foo         | column               | value
-------------+----------------------+-------
 foo.bar.baz | 1370528287:170164551 |     0

cqlsh:foo> 

cassandra-cli path

$ cassandra-cli
Connected to: "Test Cluster" on 127.0.0.1/9160
Welcome to Cassandra CLI version 1.2.5
[default@unknown] use foo;
Authenticated to keyspace: foo
[default@foo] set foos['foo.bar.baz']['1370528287:170164552'] = 0;
cannot parse '0' as hex bytes

This is the same error as in the helenus path below. Looks like Thrift / CQL3 incompatibility.

helenus path

var helenus = require('helenus');
var pool = new helenus.ConnectionPool({
  hosts: ["localhost:9160"],
  keyspace: "foo"
});
pool.connect(function (error) {
  if (error) return console.error(error);
  pool.cql("INSERT INTO foos (foo, column, value) VALUES (?, ?, ?);", ['foo.bar.baz','1370528287:170164551', 0], function (error) {
    console.dir(error);
  });
});
// outputs: { [HelenusInvalidRequestException: cannot parse '0' as hex bytes] name: 'HelenusInvalidRequestException' }
pool.connect(function (error) {
  if (error) return console.error(error);
  pool.cql("INSERT INTO foos (foo, column, value) VALUES ('foo.bar.baz', '1370528287:170164551', 0);", function (error) {
    console.dir(error);
  });
});
// outputs: { [HelenusInvalidRequestException: cannot parse '0' as hex bytes] name: 'HelenusInvalidRequestException' }

@tristanls
Copy link
Contributor Author

Found a solution, the cqlVersion has to be explicitly set as it defaults to undefined :/

var helenus = require('helenus');
var pool = new helenus.ConnectionPool({
  hosts: ["localhost:9160"],
  keyspace: "foo",
  cqlVersion: "3.0.0"
});

There should be a sane error messages if cqlVersion is undefined.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants