mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
raft: expose RecentActive in Progress
This commit is contained in:
parent
9b26753dbf
commit
9df46f9d6f
@ -59,7 +59,7 @@ type Progress struct {
|
||||
// recentActive is true if the progress is recently active. Receiving any messages
|
||||
// from the corresponding follower indicates the progress is active.
|
||||
// recentActive can be reset to false after an election timeout.
|
||||
recentActive bool
|
||||
RecentActive bool
|
||||
|
||||
// inflights is a sliding window for the inflight messages.
|
||||
// When inflights is full, no more message should be sent.
|
||||
@ -73,7 +73,7 @@ type Progress struct {
|
||||
|
||||
func (pr *Progress) resetState(state ProgressStateType) {
|
||||
pr.Paused = false
|
||||
pr.recentActive = false
|
||||
pr.RecentActive = false
|
||||
pr.PendingSnapshot = 0
|
||||
pr.State = state
|
||||
pr.ins.reset()
|
||||
|
@ -600,7 +600,7 @@ func stepLeader(r *raft, m pb.Message) {
|
||||
}
|
||||
switch m.Type {
|
||||
case pb.MsgAppResp:
|
||||
pr.recentActive = true
|
||||
pr.RecentActive = true
|
||||
|
||||
if m.Reject {
|
||||
r.logger.Debugf("%x received msgApp rejection(lastindex: %d) from %x for index %d",
|
||||
@ -635,7 +635,7 @@ func stepLeader(r *raft, m pb.Message) {
|
||||
}
|
||||
}
|
||||
case pb.MsgHeartbeatResp:
|
||||
pr.recentActive = true
|
||||
pr.RecentActive = true
|
||||
|
||||
// free one slot for the full inflights window to allow progress.
|
||||
if pr.State == ProgressStateReplicate && pr.ins.full() {
|
||||
@ -867,11 +867,11 @@ func (r *raft) checkQuorumActive() bool {
|
||||
continue
|
||||
}
|
||||
|
||||
if r.prs[id].recentActive {
|
||||
if r.prs[id].RecentActive {
|
||||
act += 1
|
||||
}
|
||||
|
||||
r.prs[id].recentActive = false
|
||||
r.prs[id].RecentActive = false
|
||||
}
|
||||
|
||||
return act >= r.q()
|
||||
|
Loading…
x
Reference in New Issue
Block a user