-
Notifications
You must be signed in to change notification settings - Fork 3.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
sql: don't clear the memory account of the prepared stmt #83615
Conversation
Previously, we had a bug of clearing the memory account of the prepared statements right after that prepared statement is created although we do keep the struct around. I believe this bug was introduced long time ago, and it could result in some memory not being accounted for. This is now fixed. Release note: None
I'm also quite lazy and would like to not do any of the follow-up actions described in #72581 (including adding the corresponding tests), hoping we can just agree that it's better to have this issue fixed quickly rather than waiting until someone has free cycles to address the issue proper. 🤞 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @mgartner and @yuzefovich)
pkg/sql/conn_executor_prepare.go
line 158 at r1 (raw file):
// NB: if we start caching the plan, we'll want to keep around the memory // account used for the plan, rather than clearing it. defer prepared.memAcc.Clear(ctx)
It seems like if we remove this we should have some basic test that the decRef/incRef stuff is working and we aren't leaking, no?
I think it's ok to not add any new tests since this commit will not break the ref counting if it wasn't broken before. In other words, this commit cannot introduce an accounting leak, but it can make already existing leak larger. I don't think I've seen any evidence of that leak existing in the first place, so it seems ok (and worth it) to merge this without any new tests. |
Friendly ping @cucaroach @mgartner |
TFTR! bors r+ |
Build failed (retrying...): |
Build succeeded: |
Previously, we had a bug of clearing the memory account of the prepared
statements right after that prepared statement is created although we do
keep the struct around. I believe this bug was introduced long time ago,
and it could result in some memory not being accounted for. This is now
fixed.
Partially addresses: #72581.
Release note: None