Re: background worker and normal exit - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: background worker and normal exit
Date
Msg-id CAB7nPqQAsTw1WBritdMbmSO4iurqNqPgwjW=u_Z35SPpcw4+FQ@mail.gmail.com
Whole thread Raw
In response to Re: background worker and normal exit  (Bernd Helmle <mailings@oopsware.de>)
Responses Re: background worker and normal exit
List pgsql-hackers
<div dir="ltr">On Mon, May 27, 2013 at 2:04 AM, Bernd Helmle <span dir="ltr"><<a href="mailto:mailings@oopsware.de"
target="_blank">mailings@oopsware.de</a>></span>wrote:<br /><div class="gmail_extra"><div
class="gmail_quote"><blockquoteclass="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex"><divclass="im"><br /><br /> --On 26. Mai 2013 11:38:55 +0900 Michael Paquier <<a
href="mailto:michael.paquier@gmail.com"target="_blank">michael.paquier@gmail.com</a>> wrote:<br /><br /><blockquote
class="gmail_quote"style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br /> This
flagmakes a worker not to restart only in case of a crash. To solve<br /> your problem, you could as well allow your
processto restart and put it<br /> in indefinite sleep if server is not in recovery such it it will do<br /> nothing in
yourcase.<br /></blockquote><br /></div> 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?<spanclass=""><font color="#888888"><br /></font></span></blockquote></div>Bgworkers are expected to run all
thetime, and will be restarted each time they exit cleanly with a status code 0. Note that they are *still* restarted
immediatelyeven if bgw_restart_time is set at BGW_NEVER_RESTART or to a certain value.<br /></div><div
class="gmail_extra">Thereare actually two ways you can use to have them perform a one-time task:<br /></div><div
class="gmail_extra">-put it in indefinite sleep after the task is accomplished<br /></div><div class="gmail_extra"> -
setbgw_restart_time to BGW_NEVER_RESTART. and have the bgworler exit with non-0 status code.<br /><br /></div><div
class="gmail_extra">Regards,<br/></div>-- <br /><div class="gmail_extra">Michael<br /></div></div> 

pgsql-hackers by date:

Previous
From: Noah Misch
Date:
Subject: Re: Parallel Sort
Next
From: Stephen Frost
Date:
Subject: Re: Parallel Sort