derekkraan / horde

Horde is a distributed Supervisor and Registry backed by DeltaCrdt
MIT License
1.32k stars 106 forks source link

Fix cleaning keys after a Horde.Registry member exits the cluster #204

Closed balena closed 3 years ago

balena commented 4 years ago

The shortest solution is to augment the pids_ets_table with the member name, so on :remove the keys are also cleaned up.

Issue is documented here: https://github.com/derekkraan/horde/issues/203

derekkraan commented 4 years ago

Hi @balena, do you think you could add a test for this new code? Sorry it has taken me so long to respond, this PR looks great, I'm not sure why this didn't occur to me before :thinking:

balena commented 4 years ago

OK, I'll do that in my spare time. However, I'm wondering: as a matter of consistency, Horde.Supervisor would have something defined for this case as well... Processes should be forcefully handed off / terminated. What do you think?

derekkraan commented 4 years ago

@balena I believe there are also dangling references left in Horde.DynamicSupervisor when a node is removed from the members list, so we should indeed probably also clean that up.

Horde.DynamicSupervisor actually never force-stops a process (unless asked to by the user, or rebalancing or shutting down). Conflict detection is left up to Horde.Registry, because otherwise you get race conditions from enforcing uniqueness in two places.

derekkraan commented 3 years ago

Hi @balena I've incorporated the crux of these changes in https://github.com/derekkraan/horde/commit/0779b2b07cbcce8ad58517641ab622de915ed036