-
Notifications
You must be signed in to change notification settings - Fork 899
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
Fix leaks with functions in DML #7088
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
If plpgsql functions are used in DML queries then we were leaking 8KB for every invocation of that function. This can quickly add up. The issue was that the "CurTransactionContext" was not getting cleaned up after every invocation. The reason was that we were inadvertantly allocating a temporary list in that context. Postgres then thought that this CurTransactionContext needs to be re-used further and kept it around. We now use a proper memory context to avoid this. Fixes timescale#7053
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #7088 +/- ##
==========================================
+ Coverage 80.06% 81.82% +1.76%
==========================================
Files 190 200 +10
Lines 37181 37323 +142
Branches 9450 9738 +288
==========================================
+ Hits 29770 30541 +771
+ Misses 2997 2873 -124
+ Partials 4414 3909 -505 ☔ View full report in Codecov by Sentry. |
mkindahl
approved these changes
Jul 2, 2024
svenklemm
approved these changes
Jul 2, 2024
pallavisontakke
added
auto-backport-not-done
Automated backport of this PR has failed non-retriably (e.g. conflicts)
backported-2.15.x
labels
Jul 2, 2024
pallavisontakke
added a commit
to pallavisontakke/timescaledb
that referenced
this pull request
Jul 2, 2024
For PRs timescale#7088 and timescale#7035 Some more edits for docs compliance.
Merged
pallavisontakke
added a commit
that referenced
this pull request
Jul 2, 2024
This release contains bug fixes since the 2.15.2 release. Best practice is to upgrade at the next available opportunity. **Migrating from self-hosted TimescaleDB v2.14.x and earlier** After you run `ALTER EXTENSION`, you must run [this SQL script](https://github.com/timescale/timescaledb-extras/blob/master/utils/2.15.X-fix_hypertable_foreign_keys.sql). For more details, see the following pull request [#6797](#6797). If you are migrating from TimescaleDB v2.15.0, v2.15.1 or v2.15.2, no changes are required. **Bugfixes** * #7061: Fix the handling of multiple unique indexes in a compressed INSERT. * #7080: Fix the `corresponding equivalence member not found` error. * #7088: Fix the leaks in the DML functions. * #7035: Fix the error when acquiring a tuple lock on the OSM chunks on the replica. **Thanks** * @Kazmirchuk for reporting the issue about leaks with the functions in DML.
pallavisontakke
added a commit
to pallavisontakke/timescaledb
that referenced
this pull request
Jul 2, 2024
This release contains performance improvements and bug fixes since the 2.15.2 release. Best practice is to upgrade at the next available opportunity. **Features** **Bugfixes** * timescale#7061 Fix handling of multiple unique indexes in compressed INSERT * timescale#7080 Fix `corresponding equivalence member not found` error * timescale#7088 Fix leaks with functions in DML **Thanks** * @Kazmirchuk for reporting this
Merged
svenklemm
pushed a commit
to pallavisontakke/timescaledb
that referenced
this pull request
Jul 2, 2024
This release contains performance improvements and bug fixes since the 2.15.2 release. Best practice is to upgrade at the next available opportunity. **Features** **Bugfixes** * timescale#7061 Fix handling of multiple unique indexes in compressed INSERT * timescale#7080 Fix `corresponding equivalence member not found` error * timescale#7088 Fix leaks with functions in DML **Thanks** * @Kazmirchuk for reporting this
svenklemm
added a commit
that referenced
this pull request
Jul 2, 2024
This release contains bug fixes since the 2.15.2 release. Best practice is to upgrade at the next available opportunity. **Migrating from self-hosted TimescaleDB v2.14.x and earlier** After you run `ALTER EXTENSION`, you must run [this SQL script](https://github.com/timescale/timescaledb-extras/blob/master/utils/2.15.X-fix_hypertable_foreign_keys.sql). For more details, see the following pull request [#6797](#6797). If you are migrating from TimescaleDB v2.15.0, v2.15.1 or v2.15.2, no changes are required. **Bugfixes** * #7061: Fix the handling of multiple unique indexes in a compressed INSERT. * #7080: Fix the `corresponding equivalence member not found` error. * #7088: Fix the leaks in the DML functions. * #7035: Fix the error when acquiring a tuple lock on the OSM chunks on the replica. * #7091: Fix ORDER BY/GROUP BY expression not found in targetlist on PG16 **Thanks** * @Kazmirchuk for reporting the issue about leaks with the functions in DML. --------- Signed-off-by: Sven Klemm <[email protected]> Co-authored-by: Sven Klemm <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
auto-backport-not-done
Automated backport of this PR has failed non-retriably (e.g. conflicts)
backported-2.15.x
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
If plpgsql functions are used in DML queries then we were leaking 8KB for every invocation of that function. This can quickly add up.
The issue was that the "CurTransactionContext" was not getting cleaned up after every invocation. The reason was that we were inadvertantly allocating a temporary list in that context. Postgres then thought that this CurTransactionContext needs to be re-used further and kept it around. We now use a proper memory context to avoid this.
Fixes #7053