Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Understanding of Isolation in Cassandra Db

As per the Cassandra docs Isolation in Cassandra provides row-level isolation. This means that a write to a row within a single partition on a single node is only visible to the client performing the operation.

Now I assume that in cassandra docs by write they means both Insert and Update.

My question is:

Consider a scenario where I am updating a row and at the same time other user is also updating the same row. Now because of isolation guarantee provided by Cassandra we can't be sure what will be final state of updated row.

Is my understanding about Isolation in Cassandra db as seen from the above statement correct?

like image 331
Yug Singh Avatar asked Mar 05 '23 20:03

Yug Singh


1 Answers

The isolation means that when reading during the update the people see either the entire update to that row applied or none. ie if theres a age and favorite_color column in the row, and they are updating both columns, someone reading will either see the entire the old version, or the entire new version. They will not see age as old value and favorite_color as the new version.

writes to a row [...] are not visible to any other user until they are complete

To prevent race conditions where two updaters writing at same time is a different problem which can be solved with light weight transactions (read before write with paxos round) where only one write would "win" and the other query will report that it was not applied.

like image 115
Chris Lohfink Avatar answered Mar 13 '23 01:03

Chris Lohfink