Browse Source

raft: clarify Heartbeat/ElectionTick comments

Avoid other, ambiguous interpretations.
Peter Bourgon 9 years ago
parent
commit
6c1b3a71db
1 changed files with 9 additions and 8 deletions
  1. 9 8
      raft/raft.go

+ 9 - 8
raft/raft.go

@@ -66,15 +66,16 @@ type Config struct {
 	// peer is private and only used for testing right now.
 	// peer is private and only used for testing right now.
 	peers []uint64
 	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
 	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
 	HeartbeatTick int
 
 
 	// Storage is the storage for raft. raft generates entries and
 	// Storage is the storage for raft. raft generates entries and