From 8a4b31a1098101f3eee6d2eb2b658e0e24b25183 Mon Sep 17 00:00:00 2001 From: Yifan Xu <30385241+xuyifangreeneyes@users.noreply.github.com> Date: Mon, 26 Dec 2022 16:12:15 +0800 Subject: [PATCH] store/copr: don't reset concurrency of analyze req to 2 (#40168) close pingcap/tidb#40162 --- store/copr/coprocessor.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/store/copr/coprocessor.go b/store/copr/coprocessor.go index 390c5ffe8e63a..94a2f478290a8 100644 --- a/store/copr/coprocessor.go +++ b/store/copr/coprocessor.go @@ -213,7 +213,8 @@ func (c *CopClient) BuildCopIterator(ctx context.Context, req *kv.Request, vars // higher concurrency, the data is just cached and not consumed for a while, this increase the memory usage. // Set concurrency to 2 can reduce the memory usage and I've tested that it does not necessarily // decrease the performance. - if it.concurrency > 2 { + // For ReqTypeAnalyze, we keep its concurrency to avoid slow analyze(see https://github.com/pingcap/tidb/issues/40162 for details). + if it.concurrency > 2 && it.req.Tp != kv.ReqTypeAnalyze { oldConcurrency := it.concurrency it.concurrency = 2