0
votes

Quoting from this article:

http://www.datastax.com/dev/blog/4-simple-rules-when-using-the-datastax-drivers-for-cassandra

"Cassandra’s storage engine is optimized to avoid storing unnecessary empty columns, but when using prepared statements those parameters that are not provided result in null values being passed to Cassandra (and thus tombstones being stored). Currently the only workaround for this scenario is to have a predefined set of prepared statement for the most common insert combinations and using normal statements for the more rare cases."

I noticed that there is a task to explore possible resolutions of this problem:

https://issues.apache.org/jira/browse/CASSANDRA-7304

But I cannot seem to find whether this has actually been resolved, in which release (of the Java Cassandra driver for example) and how?

If not resolved, is having different insert statements still the best work around?

1

1 Answers

2
votes

Unset variables are relatively recent and indeed can be used to avoid tombstones when executing prepared statements, but they are only available from protocol V4 onwards, that is, from Cassandra 2.2 onwards.

Support for unset variables in the Java driver is available from version 3.0.0. When using protocol V4, all variables will be considered unset by default, unless you explicitly set them to something else. If you need to "un-set" a previously set variable, you can call one of the unset() methods of a BoundStatement.