bitwalker / swarm

Easy clustering, registration, and distribution of worker processes for Erlang/Elixir
MIT License
1.2k stars 103 forks source link

Make remove_meta act the same as add_meta when the local clock dominates the remote by applying the remove operation anyway #76

Closed radu-iviniciu closed 6 years ago

radu-iviniciu commented 6 years ago

We ran into remove_meta operations not getting replicated across nodes when the local clock was overtaking the remote one when doing join_group followed by a leave_group. This ultimately meant inconsistent state across nodes.

Since add_meta replicate event applies the change even when local clock loses if the meta is missing we though keeping things consistent with remove: remove the meta if the meta is there.

Alternative considered: Change add_meta to ignore the replicate event operation the way remove_meta does. This makes the two consistent in the opposite manner. Decided against this.

bitwalker commented 6 years ago

I think we will ultimately be changing this to behave the other way, but I think for now we need this behaviour for consistency, so I'll merge in the meantime.