From fe5b3ec5940ba0d3ccacdc5046a944a3d99edcf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B7=B7=E6=B2=8CDM?= Date: Mon, 6 Sep 2021 15:58:58 +0800 Subject: [PATCH] checker: judging that the peer is down is no longer based on DownSeconds (#4078) * checker: judging that the peer is down is no longer based on DownSeconds Signed-off-by: HunDunDM * address comment Signed-off-by: HunDunDM Co-authored-by: Ti Chi Robot --- server/schedule/checker/replica_checker.go | 5 +---- server/schedule/checker/rule_checker.go | 4 +--- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/server/schedule/checker/replica_checker.go b/server/schedule/checker/replica_checker.go index 4f93058d905..5edf8a2d6cc 100644 --- a/server/schedule/checker/replica_checker.go +++ b/server/schedule/checker/replica_checker.go @@ -106,13 +106,10 @@ func (r *ReplicaChecker) checkDownPeer(region *core.RegionInfo) *operator.Operat log.Warn("lost the store, maybe you are recovering the PD cluster", zap.Uint64("store-id", storeID)) return nil } + // Only consider the state of the Store, not `stats.DownSeconds`. if store.DownTime() < r.opts.GetMaxStoreDownTime() { continue } - if stats.GetDownSeconds() < uint64(r.opts.GetMaxStoreDownTime().Seconds()) { - continue - } - return r.fixPeer(region, storeID, downStatus) } return nil diff --git a/server/schedule/checker/rule_checker.go b/server/schedule/checker/rule_checker.go index 3b1b95137d4..6ce4e8de449 100644 --- a/server/schedule/checker/rule_checker.go +++ b/server/schedule/checker/rule_checker.go @@ -292,12 +292,10 @@ func (c *RuleChecker) isDownPeer(region *core.RegionInfo, peer *metapb.Peer) boo log.Warn("lost the store, maybe you are recovering the PD cluster", zap.Uint64("store-id", storeID)) return false } + // Only consider the state of the Store, not `stats.DownSeconds`. if store.DownTime() < c.cluster.GetOpts().GetMaxStoreDownTime() { continue } - if stats.GetDownSeconds() < uint64(c.cluster.GetOpts().GetMaxStoreDownTime().Seconds()) { - continue - } return true } return false