postgres-operator icon indicating copy to clipboard operation
postgres-operator copied to clipboard

Turn off JIT for only monitoring user's context

Open chobostar opened this issue 3 years ago • 0 comments

Dear, maintainers!

Thanks you for this operator and accumulation a lot of useful expertise around the best practices inside it. I bring a small improvement to the existing solution against memory leaks. Here it is.


It prevents issues related to monitoring queries:

  • slow query executing due to unnecessary inlining, optimization and emission
  • memory leak due to re-creating struct types during inlining

related issues (CrunchyData/crunchy-containers#1381) (CrunchyData/pgmonitor#182)

On the other hand database is open to enabling JIT for other users

Signed-off-by: Kirill Petrov [email protected]

Checklist:

  • [x] Have you added an explanation of what your changes do and why you'd like them to be included?
  • [x] Have you updated or added documentation for the change, as applicable?
  • [x] Have you tested your changes on all related environments with successful results, as applicable?
    • [x] Have you added automated tests?

Type of Changes:

  • [ ] New feature
  • [x] Bug fix
  • [x] Documentation
  • [x] Testing enhancement
  • [ ] Other

What is the current behavior (link to any open issues here)?

I believe that relevant discussions around JIT's memory leak is here: https://www.postgresql.org/message-id/20210417021602.7dilihkdc7oblrf7%40alap3.anarazel.de

The issue currently occurs atleast on Postgres 12.

Currently JIT is disabled in whole database: https://github.com/CrunchyData/crunchy-containers/pull/1309

It's not transparent for other database users and in the case of enabling JIT, one can face memory leaks and performance issues again.

What is the new behavior (if this is a feature change)?

  • [ ] Breaking change (fix or feature that would cause existing functionality to change)

Disabling JIT in ccp_monitoring's context is more explicit than current approach, thus I hope it safer for plain PGO users and obvious for PGO developers.

Other Information:

chobostar avatar Sep 19 '22 11:09 chobostar