From 810417f685661e0387da5610f7f1ec7be0a4d79e Mon Sep 17 00:00:00 2001 From: Ryan Leung Date: Fri, 5 Aug 2022 16:22:13 +0800 Subject: [PATCH] fix the wrong store monitor Signed-off-by: Ryan Leung --- server/core/store.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/server/core/store.go b/server/core/store.go index 22e59b355b0..1f9973ec58e 100644 --- a/server/core/store.go +++ b/server/core/store.go @@ -29,10 +29,9 @@ import ( const ( // Interval to save store meta (including heartbeat ts) to etcd. - storePersistInterval = 5 * time.Minute - initialMaxRegionCounts = 30 // exclude storage Threshold Filter when region less than 30 - initialMinSpace = 8 * units.GiB // 2^33=8GB - slowStoreThreshold = 80 + storePersistInterval = 5 * time.Minute + initialMinSpace = 8 * units.GiB // 2^33=8GB + slowStoreThreshold = 80 // EngineKey is the label key used to indicate engine. EngineKey = "engine" @@ -425,13 +424,14 @@ func (s *StoreInfo) AvailableRatio() float64 { } // IsLowSpace checks if the store is lack of space. Not check if region count less -// than initialMaxRegionCounts and available space more than initialMinSpace +// than InitClusterRegionThreshold and available space more than initialMinSpace func (s *StoreInfo) IsLowSpace(lowSpaceRatio float64) bool { if s.GetStoreStats() == nil { return false } - // issue #3444 - if s.regionCount < initialMaxRegionCounts && s.GetAvailable() > initialMinSpace { + // See https://github.com/tikv/pd/issues/3444 and https://github.com/tikv/pd/issues/5391 + // TODO: we need find a better way to get the init region number when starting a new cluster. + if s.regionCount < InitClusterRegionThreshold && s.GetAvailable() > initialMinSpace { return false } return s.AvailableRatio() < 1-lowSpaceRatio