Dear folks,

I have doubt on how Cassandra performs a write request; I have two
scenarios, please read them and ensure which one is correct?


Assume we have cluster consists of 4 nodes N1, N2, N3, and N4. As Cassandra
distributes the nodes in ring topology, the nodes links as following:

N-->N-->N3-->N4-->N1

Also we have replication factor equal to 3 (RF=3), and consistency level
equals to ALL (CL=ALL).

Client sends write request, W, to coordinator, say N4. The partitioner has
determined the primary node of W is N1.

What will happen now?


*Scenario 1**:* coordinator sends W to N1. Upon receiving W, N1 stores it
locally (in commitLog and memtable, *please forget about internal process*)
and acknowledges the coordinator N4. Then N1 sends a copy of W to N2
(because N2 is next node in ring from N1 prospective). Upon receiving W, N2
stores it locally and sends acknowledgement to N4. Then N2 sends a copy of
W to N3 (because N3 is next node in ring from N2 prospective). Upon
receiving W, N3 stores it locally and acknowledges the Coordinator N4.
Finally as soon as coordinator, N4, receives an acknowledgement from all
nodes (N1, N2, and N3), it replays to the client.

Note that: if scenario 1 correct, then the latency will be 4 rounds (N4-->N1
-->N2-->N3-->N4 ----client).



*Scenario 2:*  coordinator, N4, broadcasts W to N1, N2, and N3 (N4-->N1, N4
-->N2, N4-->N3). Then replicas (N1, N2, and N3) store W locally and
acknowledge to N4.  When N4 receives all ACKs, it replays to client.



Can anyone confirm which scenario is correct in Cassandra?



Regards?



Ibrahim

Reply via email to