VOL-1691 Fix openolt adapter getting stuck while registartion with core
Change-Id: Ide8131f325bc15f1b909e14d7af6ee9bcd6b3b5b
diff --git a/vendor/go.etcd.io/etcd/raft/status.go b/vendor/go.etcd.io/etcd/raft/status.go
index 9feca7c..bf4898c 100644
--- a/vendor/go.etcd.io/etcd/raft/status.go
+++ b/vendor/go.etcd.io/etcd/raft/status.go
@@ -18,6 +18,7 @@
"fmt"
pb "go.etcd.io/etcd/raft/raftpb"
+ "go.etcd.io/etcd/raft/tracker"
)
type Status struct {
@@ -27,21 +28,24 @@
SoftState
Applied uint64
- Progress map[uint64]Progress
+ Progress map[uint64]tracker.Progress
LeadTransferee uint64
}
-func getProgressCopy(r *raft) map[uint64]Progress {
- prs := make(map[uint64]Progress)
- for id, p := range r.prs {
- prs[id] = *p
- }
+func getProgressCopy(r *raft) map[uint64]tracker.Progress {
+ m := make(map[uint64]tracker.Progress)
+ r.prs.Visit(func(id uint64, pr *tracker.Progress) {
+ var p tracker.Progress
+ p, pr = *pr, nil /* avoid accidental reuse below */
- for id, p := range r.learnerPrs {
- prs[id] = *p
- }
- return prs
+ // The inflight buffer is tricky to copy and besides, it isn't exposed
+ // to the client, so pretend it's nil.
+ p.Inflights = nil
+
+ m[id] = p
+ })
+ return m
}
func getStatusWithoutProgress(r *raft) Status {