From ea306fc40eab1bc8b0e5c3690fa7397a24ec7c91 Mon Sep 17 00:00:00 2001 From: tiancaiamao Date: Fri, 15 Jul 2022 18:53:05 +0800 Subject: [PATCH] store/copr: use non-buffered channel for coprocessor response (#35988) close pingcap/tidb#35987 --- store/copr/coprocessor.go | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/store/copr/coprocessor.go b/store/copr/coprocessor.go index 392e31c559cd4..6714e6e622093 100644 --- a/store/copr/coprocessor.go +++ b/store/copr/coprocessor.go @@ -123,21 +123,7 @@ func (c *CopClient) Send(ctx context.Context, req *kv.Request, variables interfa it.sendRate = util.NewRateLimit(2 * it.concurrency) it.respChan = nil } else { - capacity := it.concurrency - if enabledRateLimitAction { - // The count of cached response in memory is controlled by the capacity of the it.sendRate, not capacity of the respChan. - // As the worker will send finCopResponse after each task being handled, we make the capacity of the respCh equals to - // 2*it.concurrency to avoid deadlock in the unit test caused by the `MustExec` or `Exec` - capacity = it.concurrency * 2 - } - // in paging request, a request will be returned in multi batches, - // enlarge the channel size to avoid the request blocked by buffer full. - if req.Paging { - if capacity < 2048 { - capacity = 2048 - } - } - it.respChan = make(chan *copResponse, capacity) + it.respChan = make(chan *copResponse) it.sendRate = util.NewRateLimit(it.concurrency) } it.actionOnExceed = newRateLimitAction(uint(it.sendRate.GetCapacity()))