5

The Cassandra 2.0 documentation contains the following paragraph on Atomicity:

For example, if using a write consistency level of QUORUM with a replication factor of 3, Cassandra will replicate the write to all nodes in the cluster and wait for acknowledgement from two nodes. If the write fails on one of the nodes but succeeds on the other, Cassandra reports a failure to replicate the write on that node. However, the replicated write that succeeds on the other node is not automatically rolled back.

So, write requests are sent to 3 nodes, and we're waiting for 2 ACKs. Let's assume we only receive 1 ACK (before timeout). So it's clear, that if we read with consistency ONE, that we may read the value, ok.

But which of the following statements is also true:

  • It may occur, that the write has been persisted on a second node, but the node's ACK got lost? (Note: This could result in a read of the value even at read consistency QUORUM!)
  • It may occur, that the write will be persisted later to a second node (e.g. due to hinted handoff)? (Note: This could result in a read of the value even at read consistency QUORUM!)
  • It's impossible, that the write is persisted on a second node, and the written value will eventually be removed from the node via ReadRepair?
  • It's impossible, that the write is persisted on a second node, but it is necessary to perform a manual "undo" action?
Community
  • 1
  • 1
Chris Lercher
  • 37,264
  • 20
  • 99
  • 131

1 Answers1

0

I believe you are mixing atomicity and consistency. Atomicity is not guaranteed across nodes whereas consistency is. Only writes to a single row in a single node are atomic in the truest sense of atomicity.

The only time Cassandra will fail a write is when too few replicas are alive when the coordinator receives the request i.e it cannot meet the consistency level. Otherwise your second statement is correct. It will hint that the failed node (replica) will need to have this row replicated.

This article describes the different failure conditions. http://www.datastax.com/dev/blog/how-cassandra-deals-with-replica-failure

trulite
  • 359
  • 1
  • 4