Bringing together the Apache Cassandra experts from the community and DataStax.

Want to learn? Have a question? Want to share your expertise? You are in the right place!

Not sure where to begin? Getting Started

 

question

dipakpat_187206 avatar image
dipakpat_187206 asked dipakpat_187206 commented

What is the impact of running repair on a table configured with TimeWindowCompactionStrategy?

We have a table with time window compaction of 1 week and ttl for the data is 1 year. if we were to run a repair on that table , would it not combine all of the sstables ? in that case expired data would not get deleted since it was compacted via repair job with all other non expired data? I am still new at Cassandra and trying to under stand repair/ compaction and twcs.

repairtwcs
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

Erick Ramirez avatar image
Erick Ramirez answered dipakpat_187206 commented

If you run repair on a table using TimeWindowCompactionStrategy within the same time window as when the data was originally written, the repaired data will get compacted together with all the other data within that window. There is a nice diagram which illustrates this in How data is maintained in Cassandra.

But if the data is repaired outside the time window (for example, a week later), the repaired data will get compacted into another SSTable that is separate from the SSTable where it "belongs".

Once the time window lapses, the SSTables don't get compacted again so the partition fragments will be scattered among different SSTables. This means that a SSTable will take longer to expire (get dropped) if it contains one or more partitions fragmented across other SSTables.

If you're interested, there is a nice explanation from Alex Dejanovski on how repairs work with TWCS in this blog post. Cheers!

1 comment Share
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

@Erick Ramirez Thank you so much for this great information. From the information i understand that running repair outside of the time window then sstable do not get compacted on twcs tables. thanks again !

0 Likes 0 ·