Skip to content
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

Add callback to mem_guard if loaded #7788

Merged
merged 1 commit into from
Mar 5, 2025

Conversation

mkindahl
Copy link
Contributor

@mkindahl mkindahl commented Mar 4, 2025

Add code to call mem_guard to enable memory tracking for background workers. This is enabled for all background workers started by timescaledb, but not to other workers started by PostgreSQL.

@mkindahl mkindahl force-pushed the bgw-under-oomguard branch from 4b698ab to 6affce6 Compare March 4, 2025 13:08
Copy link

codecov bot commented Mar 4, 2025

Codecov Report

Attention: Patch coverage is 44.44444% with 5 lines in your changes missing coverage. Please review.

Project coverage is 81.89%. Comparing base (59f50f2) to head (7180947).
Report is 804 commits behind head on main.

Files with missing lines Patch % Lines
src/bgw/job.c 44.44% 3 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7788      +/-   ##
==========================================
+ Coverage   80.06%   81.89%   +1.82%     
==========================================
  Files         190      247      +57     
  Lines       37181    45451    +8270     
  Branches     9450    11367    +1917     
==========================================
+ Hits        29770    37221    +7451     
- Misses       2997     3756     +759     
- Partials     4414     4474      +60     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mkindahl mkindahl force-pushed the bgw-under-oomguard branch from 6affce6 to 330539e Compare March 4, 2025 15:08
@mkindahl mkindahl marked this pull request as ready for review March 4, 2025 15:17
@mkindahl mkindahl force-pushed the bgw-under-oomguard branch 2 times, most recently from a34987c to 0e500bd Compare March 5, 2025 08:51
Add code to call mem_guard to enable memory tracking for background
workers. This is enabled for all background workers started by
timescaledb, but not to other workers started by PostgreSQL.
@mkindahl mkindahl force-pushed the bgw-under-oomguard branch from 0e500bd to 7180947 Compare March 5, 2025 08:51
@mkindahl
Copy link
Contributor Author

mkindahl commented Mar 5, 2025

This is intended as an interim solution until we have a proper plugin interface in place. See #7791 for a draft of the plugin interface.

@mkindahl mkindahl added this to the v2.19.0 milestone Mar 5, 2025
@mkindahl
Copy link
Contributor Author

mkindahl commented Mar 5, 2025

This is slightly hard to test (in the sense, create a good regression test), but I added printouts to mem_guard and timescaledb to print out when the jobs are started and when the mem_guard function is called, and it seems to work fine.

@mkindahl
Copy link
Contributor Author

mkindahl commented Mar 5, 2025

I will create a better regression test with a separate plugin for #7791.

@mkindahl mkindahl merged commit 910d8d4 into timescale:main Mar 5, 2025
47 of 48 checks passed
@mkindahl mkindahl deleted the bgw-under-oomguard branch March 5, 2025 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants