0

Say we have two nodes(simple replica no sharding) i.e. N1,N2 with replication factor as 2. I am using default Read and write consistency levels i.e. R and W are 1 which means it will read/write from/to single node

Scenario 1

  1. Consider write request goes to node N1 to update record R1. Say name scott updated to scott_update1
  2. Before it is replicated to N2, N1 crashed
  3. Another write request goes to node N2 to update the same record R1. Now scott updated to scott_update2
  4. Now when N1 comes back, will the name scott_update1 be updated to scott_update2 ?

Scenario 2

  1. Consider write request goes to node N1 to update record R1. Say name scott updated to scott_update1
  2. Before it is replicated to N2, N1 crashed
  3. Read request goes to node N2 to read the same record R1. It returns scott
  4. Now when N1 comes back, will the name scott_update1 be updated to scott or it will stay scott_update1 ?
0

In both scenarios, everything depends on the how long the node N1 was offline, and where the hints enabled or not...

In scenario 1, if downtime was less than 3 hours (default window to store hints), then the changes done when N1 was offline will be replayed, and value will be updated to scott_update2 because this value has greater timestamp. If downtime was larger than this window - then you need to run repair.

For scenario 2, there are 2 things - it could be eventually repaired when read repair happens, or you can explicitly run repair.

But talking about replication - write usually happens to all replicas at the same time, and consistency level specifies how many nodes need to answer to consider request as successful, so N2 could be updated as well in most cases.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.