Skip to content

Handoffs

engelsanchez edited this page Mar 1, 2013 · 4 revisions

Riak Core Notes:

  • Handoff starts when riak core decides a vnode is on a node (responsible for data) that it shouldn't be. There are two types of handoff: ownership transfer and hinted handoff. ownership transfer occurs when a vnode is determined to no longer belong to the physical node it is running on (e.g. when a new node joins the cluster) and the vnode needs to be moved. hinted handoff occurs when a "secondary" vnode took the responsibility for a "primary" vnode but the primary vnode is reachable again. In this case, riak core determines that the secondary vnode should handoff data to the primary. These two cases are opaque to a riak core application
  • There is a third type of transfer called "repair". This is only worth noting because it complicates the handoff implementation. The rest of these notes ignore repair. More about repair can be found in this commit: https://github.com/basho/riak_core/commit/036e409eb83903315dd43a37c7a93c9256863807

Handoff triggers

  • A ring update event for a ring that all other nodes have already seen.
  • A secondary vnode is idle for a period of time and the primary, original owner of the partition is up again.

From the Perspective of the "Source VNode"

From the Perspective of the "Target VNode"

  • basically everything is operates normally for this vnode as if nothing is going on
  • the only difference is periodically Mod:handle_handoff_data is called with data being handed of from the source vnode. it is expected that the target vnode will do something with this data
  • there are a bunch of mechanics that make this go but they don't seem worth noting here right now. For more info start with riak_core_handoff_receiver.