0

根据有关 Cassandra 中原子性的 Datastax 文档:QUORUM 仅在一个节点上成功写入不会回滚(检查原子性章节:http ://www.datastax.com/documentation/cassandra/1.2/webhelp/index.html#cassandra /dml/dml_about_transactions_c.html)。因此,当我在 RF=3 的集群上执行 QUORUM 写入并且一个节点发生故障时,我将获得写入错误状态,并且在另一个节点上成功写入。这会产生两种情况:

  1. 写入将在其他节点上线时传播到其他节点;
  2. 如果节点接受写入将在传播之前完全中断,则写入可能会完全丢失。

在假设的资金转移记录中处理这种失败的最佳方法是什么?

4

1 回答 1

4

When a QUORUM write fails with a "TimedOut" exception, you don't know if the write succeeded or not. You should retry the write, and treat it as if it failed. If you have multiple writes that you need to be grouped together, you should place them in a "batch", so that the batch succeeds or fails together.

In either case, you also want to be doing QUORUM reads if you care about consistent results coming back. If you had an RF=3, and the QUORUM write only got on one node, the first time a QUORUM read succeeds that includes the new value, it will be repaired on one of the other nodes, and QUORUM read will always give the new value. So even if the value is written at ONE, successive QUORUM reads will never see the value go back in time.

于 2013-08-10T16:09:34.140 回答