Search code examples
databasecassandradistributed-computing

Does Cassandra provide read-after-write consistency for a single node?


On a single node Cassandra, if I perform

write(key=A, value=3)
write(key=A, value=5)
a_value = read(key=A)

would a_value be 3, or 5? Or in other words, does Cassandra guarantee read-after-write consistency, where we always see the most recent value?


Solution

  • Yes, if the sequence of requests of read and write is Write-> Read. If your request is synchronous (session.execute), that means you wait for a response for your write request and after getting successful response you do the read request, then yes you'll get most recent value. Since for a single node, data is not distributed among multiple nodes thus does not have to worry about maintaining consistency.