From 6c1b3a71db5dd110506fe24151ab3201da5f21f7 Mon Sep 17 00:00:00 2001 From: Peter Bourgon Date: Tue, 1 Mar 2016 09:52:14 +0100 Subject: [PATCH] raft: clarify Heartbeat/ElectionTick comments Avoid other, ambiguous interpretations. --- raft/raft.go | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/raft/raft.go b/raft/raft.go index 42972f2e8..a824855fc 100644 --- a/raft/raft.go +++ b/raft/raft.go @@ -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