From 51b8eeca4c781576240e404bd3bbef4a6088f47e Mon Sep 17 00:00:00 2001 From: Weizhen Wang Date: Tue, 1 Aug 2023 11:51:11 +0800 Subject: [PATCH] statistics: kill in time when to mergeGlobalTopN with partition Signed-off-by: Weizhen Wang --- statistics/cmsketch.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/statistics/cmsketch.go b/statistics/cmsketch.go index 3c0abfdd54275..e36cdfaef949e 100644 --- a/statistics/cmsketch.go +++ b/statistics/cmsketch.go @@ -834,6 +834,9 @@ func MergePartTopN2GlobalTopN(loc *time.Location, version int, topNs []*TopN, n // 1. Check the topN first. // 2. If the topN doesn't contain the value corresponding to encodedVal. We should check the histogram. for j := 0; j < partNum; j++ { + if atomic.LoadUint32(kiiled) == 1 { + return nil, nil, nil, errors.Trace(ErrQueryInterrupted) + } if (j == i && version >= 2) || topNs[j].findTopN(val.Encoded) != -1 { continue }