cassandratombstone

Why do I see so many tombstones in Cassandra?


When I do a table repair, I see a lot of warnings like the following:

WARN  [CompactionExecutor:112958] 2016-04-07 15:39:33,160 SliceQueryFilter.java:236 - Read 10002 live and 2857 tombstoned cells

But I do not delete anything and do not set TTLs, so nothing has been deleted. Why are there so many tombstones? The datasize is about 200G, but I have inserted some cells with NULL.


Solution

  • I had the same issue recently. And the reason was that I was inserting NULL values. I just did not know that I did.

    If you use a prepared statement and you do not set some of the parameters, or you set them to NULL, or if you insert a JSON object that does not contain a key for every column of the table, then you end up with a tombstone for each of those columns.

    In case of the prepared statement you can avoid the tombstone by explicitly setting unused parameters as unset. See CASSANDRA-7304.

    Unfortunately there is no such syntax/API for JSON inserts yet. Have a look at CASSANDRA-11424 to check the progress.