1
votes

I am attempting to add a field to a user defined type in cassandra 2.1.2, using the nodejs driver from datastax. I added the field using ALTER TYPE in cqlsh. When I attempt to add a row containing the udt with a value for the new field, it gets inserted with null value, instead of value I supplied. I strongly suspect this has to do with the way the cluster is caching the prepared statement. Because I recall reading that the prepared statements are indexed by a hash of the query, I tried changing some whitespace in the query to see if it helped.This actually seemed to work, but only once. subsequent inserts result in error:

  message: 'Operation timed out - received only 0 responses.',
  info: 'Represents an error message from the server',
  code: 4352,
  consistencies: 10,
  received: 0,
  blockFor: 1,
  writeType: 'SIMPLE',
  coordinator: '127.0.0.1:9042',

and it would seem the new rows are not added.. until I restart cassandra, at which point not only do the inserts that I thought had failed show up, but subsequent ones work fine. This is very disconcerting, but fortunately I have only done this in test instances. I do need to make this change in production however, and restarting the cluster to add a single field is not really an option. Is there a better way to get the cluster to evict the cached prepared statement?

1

1 Answers

0
votes

I strongly suspect this has to do with the way the cluster is caching the prepared statement.

Put Cassandra log in DEBUG mode to be sure the prepared statement cache is the root cause. If it is, create an JIRA so the dev team can fix it...

Optionally you can also enable tracing to see what is going on server-side

To enable tracing in cqlsh, just type TRACING ON

To enable tracing with the Java driver, just call enableTracing() on the statement object