Cassandra中没有回滚,那么Cassandra如何删除失败的写入? [英] There is no rollback in Cassandra, then how does Cassandra remove failed writes?

查看:175
本文介绍了Cassandra中没有回滚,那么Cassandra如何删除失败的写入?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有一个复制因子(RF)= 2的2节点群集。
我用一致性2触发了一个插入操作。当客户端等待响应时,Cassandra开始写入这2个节点。在一个节点之间失败并且无法完成写入,而在另一节点上成功写入。客户端将不会收到成功消息,因为无法满足一致性要求。 Cassandra中没有回滚。那么,Cassandra如何以及何时从该节点中删除插入的记录或将其标记为不使用?

Suppose I have a 2 node cluster with Replication Factor(RF) = 2. I fire an insert with Consistency 2. Cassandra starts to write to these 2 nodes while client is waiting for a response. In between one node fails and could not complete the write, while write on other node succeeded. Client will not get a success message as consistency cannot be met. There is no rollback in Cassandra. So how and when does Cassandra remove the inserted record from that one node or mark it as 'not to be used'?

相关问题:即使无法满足​​一致性,Cassandra也会写一个节点(运行中)吗?

推荐答案

不是。 Cassandra会尝试在每次写入操作中复制数据,如果无法达到一致性级别,则会通知您的应用程序。但是Cassandra不会回滚写入。

It doesn't. Cassandra will try to replicate the data on each write operation and your application will be notified if the consistency level couldn't be met. But Cassandra doesn't rollback writes.

在这种情况下,您可能想要做的就是也使用较高的CL进行读取。例如。使用CL QUORUM将从两个节点读取数据,并在其中一个节点丢失数据时自动修复数据。

What you probably want to do in such cases is to use a higher CL for your reads as well. E.g. using CL QUORUM will read the data from both nodes and will automatically repair data in case its missing on one of the nodes.

这篇关于Cassandra中没有回滚,那么Cassandra如何删除失败的写入?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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