Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WAMOp-0007eF-6Y for pgsql-hackers@arkaria.postgresql.org; Mon, 03 Feb 2014 16:29:31 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WAMOo-00050c-M9 for pgsql-hackers@arkaria.postgresql.org; Mon, 03 Feb 2014 16:29:30 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WAMOn-00050T-So for pgsql-hackers@postgresql.org; Mon, 03 Feb 2014 16:29:29 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WAMOi-0001tw-4N for pgsql-hackers@postgresql.org; Mon, 03 Feb 2014 16:29:29 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id s13GTM9k032225; Mon, 3 Feb 2014 11:29:22 -0500 From: Tom Lane To: Robert Haas cc: Antonin Houska , "pgsql-hackers@postgresql.org" Subject: Re: bgworker crashed or not? In-reply-to: References: <52EBE0E0.8040303@gmail.com> <30853.1391440857@sss.pgh.pa.us> Comments: In-reply-to Robert Haas message dated "Mon, 03 Feb 2014 11:21:21 -0500" Date: Mon, 03 Feb 2014 11:29:22 -0500 Message-ID: <32224.1391444962@sss.pgh.pa.us> X-Pg-Spam-Score: -2.4 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Robert Haas writes: > On Mon, Feb 3, 2014 at 10:20 AM, Tom Lane wrote: >> So >> exit(0) - done, permanently >> exit(1) - done until restart interval >> exit(other) - crash >> and there's no way to obtain the "restart immediately" behavior? > That's what I was thinking about, yes. Of course, when the restart > interval is 0, "done until restart interval" is the same as "restart > immediately", so for anyone who wants to *always* restart immediately > there is no problem. Where you will run into trouble is if you > sometimes want to wait for the restart interval and other times want > to restart immediately. But I'm not sure that's a real use case. If > it is, I suggest that we assign it some other, more obscure exit code > and reserve 0 and 1 for what I believe will probably be the common > cases. Agreed, but after further reflection it seems like if you've declared a restart interval, then "done until restart interval" is probably the common case. So how about exit(0) - done until restart interval, or permanently if there is none exit(1) - done permanently, even if a restart interval was declared exit(other) - crash I don't offhand see a point in an "exit and restart immediately" case. Why exit at all, if you could just keep running? If you *can't* just keep running, it probably means you know you've bollixed something, so that the crash case is probably what to do anyway. > It would be potentially more useful and more general to have a > function BackgroundWorkerSetMyRestartInterval() or similar. That might be a good idea too, but I think it's orthogonal to what the exit codes mean. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers