Can I force cleanup of old tombstones?

Ztyx picture Ztyx · Dec 19, 2014 · Viewed 14.5k times · Source

I have recently lowered gc_grace_seconds for a CQL table. I am running LeveledCompactionStrategy. Is it possible for me to force purging of old tombstones from my SSTables?

Answer

phact picture phact · Dec 19, 2014

TL;DR

Your tombstones will disappear on their own through compaction bit make sure you are running repair or they may come back from the dead.

http://www.datastax.com/documentation/cassandra/2.0/cassandra/dml/dml_about_deletes_c.html

Adding some more details:

Tombstones are not immediately available for deletion until both:

1) gc_grace_seconds has expired

2) they meet the requirements configured in tombstone compaction sub-properties

I need to free up disk by expiring tombstones, how do I do this quickly?

1) Run a repair to ensure your tombstones are consistent

2) Decrease gc_grace_seconds for your table (alter table statement)

3) Configure your compaction sub properties to speed up tombstone removal:

Decrease tombstone_compaction_interval and decrease tombstone_threshold, or set unchecked_tombstone_compaction to true to ignore both conditions and collect based purely on gc grace.

Is it working?

You can see statistics about tombstones in nodetool cfstats and by using the sstable metatdata utility found in your tools directory sstablemetadata <sstable filenames>.