cassandralwt

Cassandra LWT reads


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?


Solution

  • 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.