Atomic Batches in Cassandra

时光总嘲笑我的痴心妄想 提交于 2019-12-03 14:46:30

The atomicity is co-ordinator based. This means that when you make an atomic batch mutation, it will go to one co-ordinator. If one of the mutations in your batches, 40 in your example, fails because the replica responsible for it is dead, the coordinator will write a hint for that replica and will deliver it when the dead node it back up.

However, there is one scenario in which you will end up with half applied mutations: if the co-ordinator itself has issues.

To learn more about atomic batches read this: http://www.datastax.com/dev/blog/atomic-batches-in-cassandra-1-2

They are actually called Logged batches not Atomic batches. You get more than just hints (which you'd get for any write) you also get the batch replicated to 2 other nodes before the coordinator starts to do the writes.

I wrote a blog on this a while ago: http://christopher-batey.blogspot.co.uk/2015/03/cassandra-anti-pattern-cassandra-logged.html

For your specific question "Does it remove the rest of the 39 entries and provide the required atomic nature of batch queries"

No - Casssandra has no notion of rollback. The batch log replicas will keep retrying the query until they all succeed.

Eventually Consistent is the major idea in C*, and they design batch in this same way. Different from transactions in SQL world, batches are 'replayed' instead of rollback when failure occurs.

This difference of design is reasonable, because in C*, addition is cheaper than deletion.

One thing needs to note is isolation is not permitted in C*. That is, other clients may still read partially updated value.

The feature discussion page of batch in C* https://issues.apache.org/jira/browse/CASSANDRA-4285

atomic batches should be like All or nothing. I don't think so it should replay partial log only, as it doesn't go with atomic batch definition.

-Vivek

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