node-cassandra-cql icon indicating copy to clipboard operation
node-cassandra-cql copied to clipboard

executeBatch error

Open somecallmemike opened this issue 11 years ago • 2 comments

I am trying to update using six insert statements, like so:

[ { query: 'INSERT INTO accounting_user (username, timestamp, usertype, statustype, delaytime, inputoctets, outputoctets, sessionid, sessiontime, terminatecause, nasidentifier, nasport, framedip, callingstationid) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', params: [ 'user1', 'd20ec080-23ae-11e2-9318-273e7e437743', 'broadband', 'Start', 0, 0, 0, '8312ff770d162c9777a71af111e1ec44', 21600, 'User-Request', '1.1.1.1', 37297, '2.2.2.2', '00:1d:7d:a1' ] }, { query: 'INSERT INTO accounting_ip (username, timestamp, usertype, statustype, delaytime, inputoctets, outputoctets, sessionid, sessiontime, terminatecause, nasidentifier, nasport, framedip, callingstationid) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', params: [ 'user1', 'd20ec080-23ae-11e2-9318-273e7e437743', 'broadband', 'Start', 0, 0, 0, '8312ff770d162c9777a71af111e1ec44', 21600, 'User-Request', '1.1.1.1', 37297, '2.2.2.2', '00:1d:7d:a1' ] }, { query: 'INSERT INTO accounting_session (username, timestamp, usertype, statustype, delaytime, inputoctets, outputoctets, sessionid, sessiontime, terminatecause, nasidentifier, nasport, framedip, callingstationid) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', params: [ 'user1', 'd20ec080-23ae-11e2-9318-273e7e437743', 'broadband', 'Start', 0, 0, 0, '8312ff770d162c9777a71af111e1ec44', 21600, 'User-Request', '1.1.1.1', 37297, '2.2.2.2', '00:1d:7d:a1' ] }, { query: 'INSERT INTO accounting_user (username, timestamp, usertype, statustype, delaytime, inputoctets, outputoctets, sessionid, sessiontime, terminatecause, nasidentifier, nasport, framedip, callingstationid) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', params: [ 'user1', '1ca93080-23e1-11e2-9318-273e7e437743', 'broadband', 'Stop', 0, 0, 0, '8312ff770d162c9777a71af111e1ec44', 21600, 'User-Request', '1.1.1.1', 37297, '2.2.2.2', '00:1d:7d:a1' ] }, { query: 'INSERT INTO accounting_ip (username, timestamp, usertype, statustype, delaytime, inputoctets, outputoctets, sessionid, sessiontime, terminatecause, nasidentifier, nasport, framedip, callingstationid) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', params: [ 'user1', '1ca93080-23e1-11e2-9318-273e7e437743', 'broadband', 'Stop', 0, 0, 0, '8312ff770d162c9777a71af111e1ec44', 21600, 'User-Request', '1.1.1.1', 37297, '2.2.2.2', '00:1d:7d:a1' ] }, { query: 'INSERT INTO accounting_session (username, timestamp, usertype, statustype, delaytime, inputoctets, outputoctets, sessionid, sessiontime, terminatecause, nasidentifier, nasport, framedip, callingstationid) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', params: [ 'user1', '1ca93080-23e1-11e2-9318-273e7e437743', 'broadband', 'Stop', 0, 0, 0, '8312ff770d162c9777a71af111e1ec44', 21600, 'User-Request', '1.1.1.1', 37297, '2.2.2.2', '00:1d:7d:a1' ] } ]

And getting back the following error:

{ name: 'ResponseError', message: 'Expected 8 or 0 byte long (4)', info: 'Represents a error message from the server', code: 8704, isServerUnhealthy: false }

Not sure what this error is referring to?

somecallmemike avatar Aug 07 '14 17:08 somecallmemike

First, try reducing the number of queries to one so that you can isolate the particular query this is a problem.

Then try using hints to specify the target data type:

https://github.com/jorgebay/node-cassandra-cql#how-can-specify-the-target-data-type-of-a-query-parameter

srlm-io avatar Aug 07 '14 19:08 srlm-io

@somecallmemike I've seen similar issues when I (accidentally) attempted to write strings into bigint columns.

advait avatar Sep 08 '14 17:09 advait