Configuring bgw_restart_time

Поиск
Список
Период
Сортировка
От Jeremy Finzel
Тема Configuring bgw_restart_time
Дата
Msg-id CAMa1XUjS+gM4JBpDt+25EZ2WAbDue6Wz5LOKy2_dxuObPCKHMg@mail.gmail.com
обсуждение исходный текст
Ответы Re: Configuring bgw_restart_time  (Craig Ringer <craig@2ndquadrant.com>)
Список 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

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Andrey Borodin
Дата:
Сообщение: Re: Do not check unlogged indexes on standby
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: errbacktrace