-
Notifications
You must be signed in to change notification settings - Fork 5.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Recursive CTE didn't track memory accurately #54181
Comments
Reproduce case: The max memory usage tracked is 7-8k bytes. However, the heap profile info shows the CTE operator uses at least 160M. |
/severity major |
todo: Also remember to check if memory/cpu is back to normal when this sql is killed! |
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
tidb/pkg/util/cteutil/storage.go
Lines 156 to 169 in 6695d5e
L167 create a new row container after each CTE iteration. But it didn't attach memtracker to session tracker, so the memory control will not work correctly.
Specifically, the memory control for
resTbl
of CTE is as expected, but after one iteration of the CTE computation, the memory usage of iterInTbl and iterOutTbl cannot be accurately tracked (and they also cannot be spilled to disk) because of above bug.2. What did you expect to see? (Required)
3. What did you see instead (Required)
4. What is your TiDB version? (Required)
The text was updated successfully, but these errors were encountered: