question

suujana.naga16_165607 avatar image
suujana.naga16_165607 asked Erick Ramirez answered

How do digest requests work?

I have few questions regarding the digest request, I read through the docs and the following informations are not up to the point,

1) Lets say I have 10 node cluster with the RF =3 and RC = 2,

Also for understanding let the Replicas be Node 1, Node 2 and Node 3 and Coordinator be Node 4.

For the read request, As per my understanding first coordinator (Node 4) sends the direct request to one of the node with the lower latency (Dynamic snitch) say Node 1 and gets the data, then after receiving the data It sends the digest request to one of the next latency node say Node 2 and gets only the hash and compares with the hash calculated from direct request.

Ques 1 : Is the digest request send parallelly (to Node 2) with the direct request (Or) after receiving the direct request It send the digest request ?

Ques 2 : I know the digest request for Node 3 also will be sent for data consistency, But when does the coordinator (Node 4) send the digest request to the third replica (Node 3) ? Is it after coordinator responding back to the client?

Ques 3 : Also It is mentioned in the doc only after completing the read repair the coordinator will respond back to the client?

cassandra
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

Erick Ramirez avatar image
Erick Ramirez answered

The coordinator sends a direct read request to one replica and digest requests to N replicas. The number of replicas requested for a digest depends on two factors:

  1. The keyspace replication factor.
  2. The consistency level of the query.

For read requests with a consistency of ONE or LOCAL_ONE, there are no digest requests sent to replicas since only one response is required. In this case, the coordinator only sends a direct request to one replica.

In a scenario where the keyspace has a replication factor of 3 and the request consistency is LOCAL_QUORUM, a response is required from 2 replicas so a direct request is sent to one replica and a digest request to one (and only one) other replica in the local DC.

To respond to your questions directly:

  1. The coordinator requests the data and digest from required replica(s) at the same time.
  2. As I explained above, the digest request is only requested from the replicas involved in the request. A digest will not be requested from the third replica unless you are querying with a consistency of ALL.
  3. The third item in your list looks like a statement to me. What exactly is your question?

Note that you shouldn't confuse the above with read repairs. Read repairs are only triggered for (a) requests with a consistency of ALL or (b) if you have read repair chance (read_repair_chance and dclocal_read_repair_chance) enabled on the table. Note that read repair chance has been deprecated in Cassandra 3.0.17, 3.11.3 and 4.0 (CASSANDRA-13910).

For what it's worth, I'm on holidays and have limited mobile access so my responses are delayed. Cheers!

P.S. I don't understand what you mean by "RC = 2".

Share
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.