Skip to content

Commit

Permalink
raft: extract 'tracker' package
Browse files Browse the repository at this point in the history
Mechanically extract `progressTracker`, `Progress`, and `inflights`
to their own package named `tracker`. Add lots of comments in the
progress, and take the opportunity to rename and clarify various
fields.
  • Loading branch information
tbg committed Jun 21, 2019
1 parent 6953ccc commit f9c2d00
Show file tree
Hide file tree
Showing 17 changed files with 1,065 additions and 919 deletions.
1 change: 0 additions & 1 deletion etcdserver/raft.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import (
"go.etcd.io/etcd/raft/raftpb"
"go.etcd.io/etcd/wal"
"go.etcd.io/etcd/wal/walpb"

"go.uber.org/zap"
)

Expand Down
10 changes: 5 additions & 5 deletions raft/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -353,15 +353,15 @@ func (n *node) run(r *raft) {
}
case m := <-n.recvc:
// filter out response message from unknown From.
if pr := r.prs.getProgress(m.From); pr != nil || !IsResponseMsg(m.Type) {
if pr := r.prs.Progress[m.From]; pr != nil || !IsResponseMsg(m.Type) {
r.Step(m)
}
case cc := <-n.confc:
if cc.NodeID == None {
select {
case n.confstatec <- pb.ConfState{
Nodes: r.prs.voterNodes(),
Learners: r.prs.learnerNodes()}:
Nodes: r.prs.VoterNodes(),
Learners: r.prs.LearnerNodes()}:
case <-n.done:
}
break
Expand All @@ -384,8 +384,8 @@ func (n *node) run(r *raft) {
}
select {
case n.confstatec <- pb.ConfState{
Nodes: r.prs.voterNodes(),
Learners: r.prs.learnerNodes()}:
Nodes: r.prs.VoterNodes(),
Learners: r.prs.LearnerNodes()}:
case <-n.done:
}
case <-n.tickc:
Expand Down
Loading

0 comments on commit f9c2d00

Please sign in to comment.