0

I'm not able to understand the scenario where during the write process, the desired write consistency level cannot be met. For e.g. suppose I have 3 nodes, 2 in one data center(dc1) and the remaining one in the other data center(dc2). Network Topology Strategy. Now if I'm writing with consistency level three and one of the node is down, what exactly will happen? Since 2 nodes are up, they will be able to complete the write process, however since the consistency level cannot be met, therefore the coordinator node will return a write error to the client. What will happen to the data written in the 2 nodes? The client will not be expecting any data in any node because he received a write error.

There is no rollback in Cassandra, then how does Cassandra remove failed writes? According to the above link, Cassandra does not rollback writes.

Does Cassandra write to a node(which is up) even if Consistency cannot be met? The accepted answer in the above link states that "On the nodes that the write succeeded, the data is actually written and it is going to be eventually rolled back."

Vishal Sharma
  • 1,670
  • 20
  • 55

1 Answers1

1

If the coordinator cannot write to enough replicas to meet the requested consistency level, it throws an Unavailable Exception and does not perform any writes.

If coordinator doesn't know about replica failure before hand i.e replica failed during write then coordinator will throw timeout exception and client will have to handle it. (Retry policies)

Cassandra Write Request

undefined_variable
  • 6,180
  • 2
  • 22
  • 37
  • According to the article, "the write consistency level determines how many replica nodes must respond with a success acknowledgment in order for the write to be considered successful". In the scenario I'm considering, some nodes have responded with a success acknowledgment to the coordinator node, however, that number was less than the desired consistency. Therefore, the coordinator node will give 'write error'. But what will happen with the data written in those nodes? – Vishal Sharma Jan 09 '18 at 07:18
  • `If the coordinator cannot write to enough replicas to meet the requested consistency level, it throws an Unavailable Exception and does not perform any writes.` you missed this – undefined_variable Jan 09 '18 at 07:20
  • I'm thinking about a scenario in which the coordinator node was not aware about some nodes down/not responding. Therefore in such a scenario, the coordinator node will not straight away throw an exception, but, it will wait to receive acknowledgment from the number of nodes required to meet the consistency level. And if the consistency level is not met, then what will happen with the data written in some of the nodes? – Vishal Sharma Jan 09 '18 at 07:45