timescale / timescaledb

An open-source time-series SQL database optimized for fast ingest and complex queries. Packaged as a PostgreSQL extension.
https://www.timescale.com/
Other
16.83k stars 852 forks source link

Fix leaks with functions in DML #7088

Closed nikkhils closed 5 days ago

nikkhils commented 5 days ago

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

codecov[bot] commented 5 days ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 81.82%. Comparing base (59f50f2) to head (73a8ff9). Report is 235 commits behind head on main.

Additional details and impacted files ```diff @@ 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 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.