From 9c0031114ed32e1103a49bd035c1bf8aed06c49c Mon Sep 17 00:00:00 2001 From: guo-shaoge Date: Mon, 19 Feb 2024 16:29:23 +0800 Subject: [PATCH] fix reset tracker Signed-off-by: guo-shaoge --- pkg/executor/cte.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/executor/cte.go b/pkg/executor/cte.go index 48d143a4f87b7..4c30243268821 100644 --- a/pkg/executor/cte.go +++ b/pkg/executor/cte.go @@ -266,7 +266,10 @@ func (p *cteProducer) closeProducer() (firstErr error) { firstErr = setFirstErr(firstErr, err, "deref iterOutTbl err") } } - p.resetTracker() + // Reset to nil instead of calling Detach(), + // because ExplainExec still needs tracker to get mem usage info. + p.memTracker = nil + p.diskTracker = nil p.closed = true return }