by Someone · 11y ago · 0 comments
I'm no expert at all on this stuff, but I do smell either a race condition (if other nodes comes alive and 'goes to see who owns the leader key in etcd' before the node 'takes over as leader') or a longer-than-needed time without a leader (where the new node knows it wants to become the leader, but is running health checks)
The functionality in the code is here: https://github.com/compose/governor/blob/master/helpers/etcd...
The documentation for etcd is here: https://coreos.com/etcd/docs/latest/api.html#atomic-compare-...
"If no one has the leader key it runs health checks and takes over as leader."
but
"If no one has the leader key it takes over as leader, runs health checks, and starts functioning as leader."
? If so, I would do the health checks and then try to become the leader. Or do the 'health checks' involve other nodes?
Oh and here is the Compare and Swap (Atomic) functionality of etcd that he described: https://github.com/coreos/etcd/blob/master/Documentation/api...