From: | Jeremy Finzel <finzelj(at)gmail(dot)com> |
---|---|
To: | PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Configuring bgw_restart_time |
Date: | 2019-08-13 12:37:20 |
Message-ID: | CAMa1XUjS+gM4JBpDt+25EZ2WAbDue6Wz5LOKy2_dxuObPCKHMg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
I am working on an extension that uses background workers, and interested
in adding code for it to auto-restart after a crash or server restart
(similar to as-coded in worker_spi).
But I'm also interested in being able to configure bgw_restart_time using a
GUC without having to restart the server, using only SIGHUP. For example,
I want to normally have the worker restart after 10 seconds. But if I am
doing maintenance on the server (without a db restart), I perhaps want to
change this to -1 (BGW_NEVER_RESTART), kill the worker, do my business,
then restart the worker. Or another reason would be my background worker
has some bug and I want to disable it without having to restart my db
server. For us as for many, a small outage for a db restart is expensive.
I have played around with this and done some digging around the codebase
in bgworker.c (with my limited knowledge thus far of the pg codebase), and
so far as I can tell, it isn't possible to change bgw_restart_time without
a server restart. But I'm not sure if that's just because I don't know how
this code works, or if the current libraries actually don't support
modifying this part of the background worker. I am setting the GUC in
_PG_init, but I can see that changing it after it has been registered has
no effect unless I restart the server.
If indeed this is possible, I'd be very grateful for some insight on how to
do it. I may even try to add such an example to worker_spi.
Thanks!
Jeremy
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2019-08-13 13:24:13 | Re: errbacktrace |
Previous Message | Andrey Borodin | 2019-08-13 12:17:31 | Re: Do not check unlogged indexes on standby |