Tomasz Kubiak
Tomasz Kubiak

Reputation: 370

Cassandra write with Consistency level ALL

According to documentation writing with consistency level ALL means that:

A write must be written to the commit log and memtable on all replica nodes in the cluster for that partition.

I've got a Cassandra cluster, with 3 nodes and replication factor of 3.

When having 2 out of 3 the nodes down, Cassandra writes, where consistency level is set to ALL don't fail (are still successful).

The documentation is clear when it comes to read operation:

Returns the record after all replicas have responded. The read operation will fail if a replica does not respond

When it comes to writes with consistency ALL -- will it simply try to write to all replica nodes, but if fail, then still OK (not return an Exception)?

Upvotes: 1

Views: 519

Answers (1)

Aaron
Aaron

Reputation: 57748

What you're seeing here, is known as Hinted Handoff.

Usually, the write operation is sent to a single node (coordinator) which ensures that all replicas are written and returns when meeting the consistency setting. If a replica cannot be written to, it is stored locally (on the coordinator). Once the down nodes have come back, the hints are replayed, and consistency is restored (in theory).

Keep in mind though, hints only last for 3 hours by default.

So in this scenario, writes would continue to happen, but reads would throw a "not enough replicas" exception.

Upvotes: 1

Related Questions