From 8783927d67142d385c24556ca3e60cfbdf490159 Mon Sep 17 00:00:00 2001 From: Ti Chi Robot Date: Mon, 25 Mar 2024 19:17:18 +0800 Subject: [PATCH] etcdutil: only output the log when picked count > 0 (#7845) (#7977) close tikv/pd#7844 Only output the log when picked count > 0 in `updateEvictedEps`. Signed-off-by: JmPotato Co-authored-by: JmPotato --- pkg/utils/etcdutil/health_checker.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkg/utils/etcdutil/health_checker.go b/pkg/utils/etcdutil/health_checker.go index d1a57e97c5f..51c1808de4a 100644 --- a/pkg/utils/etcdutil/health_checker.go +++ b/pkg/utils/etcdutil/health_checker.go @@ -274,12 +274,14 @@ func (checker *healthChecker) updateEvictedEps(lastEps, pickedEps []string) { pickedSet[ep] = true } // Reset the count to 0 if it's in evictedEps but not in the pickedEps. - checker.evictedEps.Range(func(key, _ any) bool { + checker.evictedEps.Range(func(key, value any) bool { ep := key.(string) - if !pickedSet[ep] { + count := value.(int) + if count > 0 && !pickedSet[ep] { checker.evictedEps.Store(ep, 0) log.Info("reset evicted etcd endpoint picked count", zap.String("endpoint", ep), + zap.Int("previous-count", count), zap.String("source", checker.source)) } return true