简体   繁体   English

Cassandra是否为单个节点提供写后读取一致性?

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

On a single node Cassandra, if I perform 如果执行,在单节点 Cassandra上

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

would a_value be 3, or 5? a_value是3还是5? Or in other words, does Cassandra guarantee read-after-write consistency, where we always see the most recent value? 换而言之,Cassandra是否保证写后读的一致性,而我们总是在其中看到最新的值?

If you wait for a response, then yes. 如果您等待答复,则可以。 If you don't wait for a response for the write request then the read request could be handled before. 如果您不等待写入请求的响应,则可以先处理读取请求。

Yes, if the sequence of requests of read and write is Write-> Read. 是的,如果读写请求的顺序为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. 如果您的请求是同步的(session.execute),则意味着您等待写入请求的响应,并且在成功获得响应之后,您将执行读取请求,那么您将获得最新的值。 Since for a single node, data is not distributed among multiple nodes thus does not have to worry about maintaining consistency. 由于对于单个节点,数据不会分布在多个节点之间,因此不必担心保持一致性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM