简体   繁体   English

写入路径失败时的 Cassandra 读取一致性

[英]Cassandra Read Consistency when write path fail

I am new to cassandra and trying to figure out how cassandra provides consistency in case of failed writes.我是 cassandra 的新手,并试图弄清楚 cassandra 如何在写入失败的情况下提供一致性。 Consider following scenario where CL is QUORUM, in which case 2 out of 3 replicas must respond.考虑以下 CL 为 QUORUM 的场景,在这种情况下,3 个副本中的 2 个必须响应。 Write request will go to all 3 replica as usual, if write to 2 replica fails, and succeeds on 1 replica, cassandra will return Failed.写入请求将照常发送到所有 3 个副本,如果写入 2 个副本失败,并且在 1 个副本上成功,则 cassandra 将返回 Failed。 Since cassandra does not rollback, the record will continue to exist on successful replica.由于 cassandra 不回滚,该记录将继续存在于成功的副本上。 Now, when the read come with CL=QUORUM,the read request will be forwarded to 2 replica node and if one of the replica node is the previously successful one then cassandra will return the new records as it will have latest timestamp.现在,当读取 CL=QUORUM 时,读取请求将转发到 2 个副本节点,如果其中一个副本节点是先前成功的节点,则 cassandra 将返回新记录,因为它将具有最新的时间戳。 But from client perspective this record was not written at all as cassandra had returned failure during write.但是从客户端的角度来看,这条记录根本没有写入,因为 cassandra 在写入过程中返回了失败。 If this is the case then cassandra will never be consistent in this scenario.如果是这种情况,那么 cassandra 在这种情况下将永远不会保持一致。 How to handle such scenario Please let me know if this understanding is correct.如何处理这种情况请让我知道这种理解是否正确。

Your understanding is correct.你的理解是正确的。 The client in this case should receive UnavailableException , but should understand that the write will eventually propagate to the other replicas (if the nodes are alive or come alive), and that this is not a failed write.在这种情况下,客户端应该收到UnavailableException ,但应该理解写入最终将传播到其他副本(如果节点处于活动状态或活跃状态),并且这不是失败的写入。

For more details see the following articles:有关更多详细信息,请参阅以下文章:

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

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