There is no rollback in Cassandra, then how does Cassandra remove failed writes?

情到浓时终转凉″ 提交于 2019-12-22 07:18:19

问题


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'?

Related Question: Does Cassandra write to a node(which is up) even if Consistency cannot be met?


回答1:


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.

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.



来源:https://stackoverflow.com/questions/30544151/there-is-no-rollback-in-cassandra-then-how-does-cassandra-remove-failed-writes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!