问题
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?
回答1:
Your assumption is incorrect due to two reasons.
- SERIAL only implies QUORUM consistency level for writes
- 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.
来源:https://stackoverflow.com/questions/28836083/cassandra-lwt-reads