Cassandra – In-Memory Tables Explained

cassandranosql

I am planning to use Cassandra in memory tables for my particular work load. THe problem is I am worried if the node fails then what will happen to the data in memory that was not flushed to disk ?

Would I loose that data, or not ?

Best Answer

Would I loose that data, or not ?

Good question! As outlined in the DataStax documentation section on The Write Path To Compaction, you would not lose data.

enter image description here

As you can see, when Cassandra processes a write operation, data is written to both the commit log (on-disk) and to the memtable (which you referred to). In case of a "plug out of the wall" event, the writes are still in the commit log. When Cassandra restarts on a node, it first replays the commit log, and verifies that all of its data have been written to disk. If it finds data in the commit log that was not flushed to disk, it writes to disk at that time.