raft: clarify Heartbeat/ElectionTick comments

Avoid other, ambiguous interpretations.
release-2.3
Peter Bourgon 2016-03-01 09:52:14 +01:00
parent f0dbd0b856
commit 6c1b3a71db
1 changed files with 9 additions and 8 deletions

View File

@ -66,15 +66,16 @@ type Config struct {
// peer is private and only used for testing right now.
peers []uint64
// ElectionTick is the election timeout. If a follower does not
// receive any message from the leader of current term during
// ElectionTick, it will become candidate and start an election.
// ElectionTick must be greater than HeartbeatTick. We suggest
// to use ElectionTick = 10 * HeartbeatTick to avoid unnecessary
// leader switching.
// ElectionTick is the number of Node.Tick invocations that must pass between
// elections. That is, if a follower does not receive any message from the
// leader of current term before ElectionTick has elapsed, it will become
// candidate and start an election. ElectionTick must be greater than
// HeartbeatTick. We suggest ElectionTick = 10 * HeartbeatTick to avoid
// unnecessary leader switching.
ElectionTick int
// HeartbeatTick is the heartbeat interval. A leader sends heartbeat
// message to maintain the leadership every heartbeat interval.
// HeartbeatTick is the number of Node.Tick invocations that must pass between
// heartbeats. That is, a leader sends heartbeat messages to maintain its
// leadership every HeartbeatTick ticks.
HeartbeatTick int
// Storage is the storage for raft. raft generates entries and