pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Antonin Houska <antonin.houska@gmail.com>
Cc: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>
Subject: Re: bgworker crashed or not?
Date: Mon, 03 Feb 2014 11:29:22 -0500
Message-ID: <32224.1391444962@sss.pgh.pa.us> (raw)
In-Reply-To: <CA+Tgmoa047dAbaEToo6QUUTMhwi4QN+EnaM+DXgW7O-9zjm=0Q@mail.gmail.com>
References: <52EBE0E0.8040303@gmail.com>
	<CA+TgmoY-ra-4ScB5=pnZmqi19OadzzM=GDKn_qvm1D+6mJ15zA@mail.gmail.com>
	<30853.1391440857@sss.pgh.pa.us>
	<CA+Tgmoa047dAbaEToo6QUUTMhwi4QN+EnaM+DXgW7O-9zjm=0Q@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

Robert Haas <robertmhaas@gmail.com> writes:
> On Mon, Feb 3, 2014 at 10:20 AM, Tom Lane <tgl@sss.pgh.pa.us> 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



view thread (36+ messages)  latest in thread

Message-ID: <32224.1391444962@sss.pgh.pa.us>
Permalink:  ../32224.1391444962@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/32224.1391444962@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, robertmhaas@gmail.com, antonin.houska@gmail.com
  Subject: Re: bgworker crashed or not?
  In-Reply-To: <32224.1391444962@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox