When updating a record, Cassandra just creates a new record with a more recent timstamp. Will the old record be marked as tombstone?
When updating a record, Cassandra just creates a new record with a more recent timstamp. Will the old record be marked as tombstone?
@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.
Thanks @ben.krug_85176. Those are very good points indeed. Cheers!
In addition I think about 2 more use cases :
5 People are following this question.
DataStax Enterprise is powered by the best distribution of Apache Cassandra ™
© 2023 DataStax, Titan, and TitanDB are registered trademarks of DataStax, Inc. and its subsidiaries in the United States and/or other countries.
Apache, Apache Cassandra, Cassandra, Apache Tomcat, Tomcat, Apache Lucene, Lucene, Apache Solr, Apache Hadoop, Hadoop, Apache Spark, Spark, Apache TinkerPop, TinkerPop, Apache Kafka and Kafka are either registered trademarks or trademarks of the Apache Software Foundation or its subsidiaries in Canada, the United States and/or other countries.
Privacy Policy Terms of Use