hashicorp/serf — pull request #167 by armon (2014-03-06 21:41:05+00:00)
Title: Automatic name conflict resolution

Fixes #119. Previously, Memberlist would detect a name conflict (two nodes claiming to be "A"), and report this to Serf via a delegate. The only action that could be taken was to log a large warning. However, with the new User Query support, we can do something more intelligent.

Now, when a conflict is detected, the two nodes involved each issue a "_serf_conflict" query, requesting that other nodes respond with their Member struct for the given node. Each node then tallies how many votes it has received. Once the query completes (default timeout), any nodes with a minority of votes shutdown.

The behavior we get is usually what we want, in that the first Node "A" to join will be the winner most of the time. In the case of a split cluster that merges, and exposes the conflict, the node in the larger cluster will remain. In some rare cases, all nodes will be in the minority and so they will all exit, but we expect this to be only in exceptional conditions.