Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cassandra LWT reads

Tags:

cassandra

lwt

It's my understanding that LWT inserts are always done with SERIAL consistency level. If true, does that mean that reading a row inserted as LWT, can be safely read with a consistency level of ANY?

In other words, I assume an LWT insert is fully consistent, making any subsequent read also fully consistent, regardless of consistency level?

like image 613
nilskp Avatar asked Mar 03 '15 15:03

nilskp


1 Answers

Your assumption is incorrect due to two reasons.

  1. SERIAL only implies QUORUM consistency level for writes
  2. There is a possibility that a single LWT will only be partially applied at time of reading and thus cannot be safely read with any CL

Therefor you need to use SERIAL for all queries that will read LWT writes. This will make sure that there are no pending LWTs while reading QUORUM.

like image 95
Stefan Podkowinski Avatar answered Oct 13 '22 21:10

Stefan Podkowinski