-
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
release-23.1: sql: add prepared_statements_cache_size setting #99254
Conversation
Thanks for opening a backport. Please check the backport criteria before merging:
If some of the basic criteria cannot be satisfied, ensure that the exceptional criteria are satisfied within.
Add a brief release justification to the body of your PR to justify this backport. Some other things to consider:
|
(Hold off on reviewing just yet.) |
c165313
to
a263d8a
Compare
I don't feel strongly about enabling this by default, but I would like to get it into 23.1, so I think this is RFAL. |
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.
I don't have a strong opinion either about the default. Perhaps we'll wait to see whether we get another report where the unlimited memory usage of prepared statements is a problem, and if it happens, then we switch the default. At least now (assuming recent enough version) we should have decent observability in place to investigate this problem.
I do agree with you that we should get this into 23.1.0.
Also didn't review too carefully.
Reviewed 16 of 16 files at r1, all commit messages.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @mgartner)
I'm hoping to merge this to release-23.1 before #99663 (which hasn't yet been committed to master, but will be soon, I think). |
LGTM. I think leaving it off by default for v23.1 is good. |
Add a new circular doubly-linked list of prepared statements to `prepStmtNamespace` which tracks the least-recently-used prepared statement. When new setting `prepared_statements_cache_size` is set, use this LRU list to automatically deallocate prepared statements. Fixes: cockroachdb#97866 Epic: None Release note (sql change): Add a new `prepared_statements_cache_size` setting which, when set to a non-zero number of bytes, causes the least- recently-used prepared statements to be automatically deallocated when prepared statement memory usage goes above the cache size. This setting can be used to avoid prepared statement leaks from long-lived connections which never `DEALLOCATE` prepared statements.
a263d8a
to
d4fed1c
Compare
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! 1 of 0 LGTMs obtained (waiting on @mgartner and @yuzefovich)
Backport 1/1 commits from #98917.
/cc @cockroachdb/release
Release justification: high priority business need for the functionality (fix for customer).
Add a new circular doubly-linked list of prepared statements to
prepStmtNamespace
which tracks the least-recently-used prepared statement. When new settingprepared_statements_cache_size
is set, use this LRU list to automatically deallocate prepared statements.Fixes: #97866
Epic: None
Release note (sql change): Add a new
prepared_statements_cache_size
setting which, when set to a non-zero number of bytes, causes the least-recently-used prepared statements to be automatically deallocated when prepared statement memory usage goes above the cache size. This setting can be used to avoid prepared statement leaks from long-lived connections which neverDEALLOCATE
prepared statements.