Cassandra LWT读取 [英] Cassandra LWT reads

查看:403
本文介绍了Cassandra LWT读取的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的理解,LWT插入总是做SERIAL一致性水平。如果为true,那是否意味着读取插入为LWT的行可以安全地读取一致性级别ANY?

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?

换句话说,我假设一个LWT插入

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

推荐答案

由于两个原因,你的假设是不正确的。

Your assumption is incorrect due to two reasons.


  1. SERIAL只表示写入的一致性级别为QUORUM

  2. 单个LWT可能会只有在阅读时才会部分应用,因此无法使用任何 CL
  3. 安全地阅读。
  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

对所有将读取LWT写入的查询使用SERIAL。这将确保在读取QUORUM时没有未决的LWT。

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.

这篇关于Cassandra LWT读取的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆