educative.io

Educative

How does get() resolve with hinted handoffs?

The get description does not account for what happens in the case where a hinted handoff occurred at the time of writing. Example:
Preference list: [A, B, C, D]
Say W = 2 ie 2 nodes must be written to.

  1. For key k1 and value v1 write goes to [A, B]
  2. Network splits, and B is unreachable. Write for key:k1, value:v2 goes to [A, C]
  3. Write for k1, v3 goes to [B, D]
  4. Network back to normal but C or D haven’t synced to B and A respectively yet.
  5. get(k1) reads from [A, B]. Note however, that the value at C and D could have been used.

Questions:

  1. Do we never attempt to read from hinted handoff nodes even if (1.1) One of the preferred nodes are down (1.2) Node is up but doesn’t have the key because hinted handoff sync hasn’t completed
  2. If we do read from the hinted handoff node, how would we resolve conflicts?

Hi @silentsea

  • If during writing, the node which was down is recovered then it will have to wait till the writing is complete.
  • We avoid reading hinted handoff nodes during writing, as they will affect the whole writing and will create conflicts, so we usually avoid that.