goraft / raft

UNMAINTAINED: A Go implementation of the Raft distributed consensus protocol.
MIT License
2.43k stars 479 forks source link

Add leader change event for followers #229

Open palquel opened 10 years ago

palquel commented 10 years ago

Fixes coreos/etcd#913

philips commented 10 years ago

This LGTM. However, does it also fix thos "empty" messages as reported in coreos/etcd#913?

Any objections @benbjohnson @xiangli-cmu ?

palquel commented 10 years ago

@philips using the coreos/etcd#913 example, the new logs should look like this:

[etcd] Jul 30 20:50:13.509 INFO      | app02: leader changed from 'app03' to ' '.
[etcd] Jul 30 20:50:13.509 INFO      | app02: leader changed from ' ' to 'app01'.

I think the empty is correct because it signals that the leader changed to no leader so we should expect a state change to follow (e.g. follower is promoted to candidate or new leader is assigned).