1

I understand that when we write data in Cassandra, partition key is hashed by a partitioner and that value is then used to determine which node in the cluster that data would be stored into. And then Cassandra replicates that data in clockwise direction in the nodes ring.

If the node determined by partitioner is down then how does Cassandra find which nodes to look into for a record? Don't we lose the advantage of partitioning here?

2 Answers 2

2

Hash that is calculated based on the value of partition key is identifying all replicas that are owning the data (if you use RF > 1). This is used by driver (when using token-aware load balancing policy) or by coordinating node to send a request to one of the replicas that are available, so you can continue to receive data (of course, if you have enough nodes to meet specified consistency level).

Sign up to request clarification or add additional context in comments.

Comments

1

if the node is down the data can be sent to the replica, depending on your replication factor and of your consistency level, your request might fail, if the number of acknowledgment required are not met. Of course, depending on your replication factor and CL, read request will be served or not. depending on how many replicas you have and how many acknowledgment you expect.

There is a cool mechanism used to help this kind of cases, it is hinted handoff. To make it simple if you have replication factor set to 1, and the node responsible of the data is down, the coordinator will store the data for him for a while ( hours) then when the node will be up again the coordinator will send him the missed data.

To make it more simple, it is like a neighbor taking your mail while your not around. This is made for small failure failures and not long one. it won't be cool if the neighbor will take the post mail for years.

Here is a link that explain how hints work

https://www.datastax.com/blog/2011/05/understanding-hinted-handoff-cassandra-08

I hope this help !

2 Comments

Your answer is related to write operation. My question is related to read scenario. If the node, which was originally determined by partitioner during write operation, is down when read query arrives, then does Cassandra now look into all other nodes i the lcuster. OR, does it keep track that which nodes that particular records was replicated into(which seems to be a heavy overhead)?
That depends on your replication factor and consistency level. for example you have RF 3 and QUORUM, Cassandra will serve the read from the other 2 node. don't think about it as primary and replicas all node are equals for your senario. How replicas node are found out, partition key and snitch configuration. I you can add more specification to your use case, I can be more specific

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.