diff --git a/replication.go b/replication.go index b62e0d0d2..900afc4c2 100644 --- a/replication.go +++ b/replication.go @@ -28,6 +28,18 @@ var ( // followerReplication is in charge of sending snapshots and log entries from // this leader during this particular term to a remote follower. type followerReplication struct { + // currentTerm and nextIndex must be kept at the top of the struct so + // they're 64 bit aligned which is a requirement for atomic ops on 32 bit + // platforms. + + // currentTerm is the term of this leader, to be included in AppendEntries + // requests. + currentTerm uint64 + + // nextIndex is the index of the next log entry to send to the follower, + // which may fall past the end of the log. + nextIndex uint64 + // peer contains the network address and ID of the remote follower. peer Server @@ -49,14 +61,6 @@ type followerReplication struct { // deferErr, the sender can be notifed when the replication is done. triggerDeferErrorCh chan *deferError - // currentTerm is the term of this leader, to be included in AppendEntries - // requests. - currentTerm uint64 - - // nextIndex is the index of the next log entry to send to the follower, - // which may fall past the end of the log. - nextIndex uint64 - // lastContact is updated to the current time whenever any response is // received from the follower (successful or not). This is used to check // whether the leader should step down (Raft.checkLeaderLease()).