When updating a record, Cassandra just creates a new record with a more recent timstamp. Will the old record be marked as tombstone?
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
@gmldba_107428 No, it doesn't create tombstones. When a row is updated, Cassandra just inserts a new row to the database without checking if a duplicate row already exists -- C* doesn't do read-before-write.
At read time, C* compares all the versions of the row if there is more than one and only returns the latest version of the row. The "latest version" being the one with the newest timestamp. Similarly at compaction time, only the newest version of the row gets written to the new SSTable and all the obsolete/out-of-date versions of the row are dropped, effectively getting deleted or compacted out.
For more details, see How data is updated in the DataStax Docs. Cheers!
To add to Erick's answer, there are a couple of exceptions - certain updates to collection data types (sets, lists, etc) will generate tombstones, and updates that affect a materialized view can generate tombstones in the materialized view. (Also, TTLs that expire generate tombstones.) . See the docs here for more details.
5 People are following this question.