I'm working on a background worker (BGW) for my pg_partman extension. I've
gotten the basics of it working for my first round, but there's two
features I'm missing that I'd like to add before release:

1) Only allow one instance of this BGW to run
2) Create a bgw_terminate_partman() function to stop it more intuitively
than doing a pg_cancel_backend() on the PID

This is my first venture into writing C code for postgres, so I'm not
familiar with a lot of the internals yet. I read
http://www.postgresql.org/docs/9.4/static/bgworker.html and I see it
mentioning how you can check the status of a BGW launched dynamically and
the function to terminate one, but I'm not clear how how you can get the
information on a currently running BGW to do these things.

I used the worker_spi example for a lot of this, so if there's any
additional guidance for a better way to do what I've done, I'd appreciate
it. All I really have it doing now is calling the run_maintenance()
function at a defined interval and don't need it doing more than that yet.

https://gist.github.com/keithf4/0047eae0b3a22829d527

--
Keith Fiske
Database Administrator
OmniTI Computer Consulting, Inc.
http://www.keithf4.com

Reply via email to