From: | Michael Paquier <michael(dot)paquier(at)gmail(dot)com> |
---|---|
To: | Bernd Helmle <mailings(at)oopsware(dot)de> |
Cc: | Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: background worker and normal exit |
Date: | 2013-05-26 22:48:51 |
Message-ID: | CAB7nPqQAsTw1WBritdMbmSO4iurqNqPgwjW=u_Z35SPpcw4+FQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Mon, May 27, 2013 at 2:04 AM, Bernd Helmle <mailings(at)oopsware(dot)de> wrote:
>
>
> --On 26. Mai 2013 11:38:55 +0900 Michael Paquier <
> michael(dot)paquier(at)gmail(dot)com> wrote:
>
>
>> This flag makes a worker not to restart only in case of a crash. To solve
>> your problem, you could as well allow your process to restart and put it
>> in indefinite sleep if server is not in recovery such it it will do
>> nothing in your case.
>>
>
> Hmm so you can't have workers just "doing something once" and exit? I have
> to admit, i didn't follow bgworkers closely in the past, but could you give
> a short insight on why this is currently not possible?
>
Bgworkers are expected to run all the time, and will be restarted each time
they exit cleanly with a status code 0. Note that they are *still*
restarted immediately even if bgw_restart_time is set at BGW_NEVER_RESTART
or to a certain value.
There are actually two ways you can use to have them perform a one-time
task:
- put it in indefinite sleep after the task is accomplished
- set bgw_restart_time to BGW_NEVER_RESTART. and have the bgworler exit
with non-0 status code.
Regards,
--
Michael
From | Date | Subject | |
---|---|---|---|
Next Message | Josh Berkus | 2013-05-26 23:58:58 | Re: getting rid of freezing |
Previous Message | Noah Misch | 2013-05-26 19:07:01 | Re: Parallel Sort |