Re: bgworker crashed or not?

From: Craig Ringer <craig(at)2ndquadrant(dot)com>
To: Petr Jelinek <petr(at)2ndquadrant(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Andres Freund <andres(at)2ndquadrant(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Antonin Houska <antonin(dot)houska(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: bgworker crashed or not?
Date: 2014-04-17 00:35:50
Message-ID: 534F21E6.7080705@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 04/17/2014 04:47 AM, Petr Jelinek wrote:
>
> Well the logging is just too spammy in general when it comes to dynamic
> bgworkers but that's easy to fix in the future, no need to make
> decisions for 9.4.

Agreed - it's the *API* that we need sorted out for 9.4, and log output
isn't something Pg tends to consider part of the API.

> However I really don't like that I have to exit with exit code 1, which
> is normally used as failure, if I want to shutdown my dynamic bgworker
> once it has finished the work. And this behavior is something we can set
> properly only once...

As far as I can tell we have a couple of options:

- Redefine what the exit codes mean so that exit 0 suppresses
auto-restart and exits silently. Probably simplest.

or

- Expose a worker's BackgroundWorkerHandle as a global within the
worker, and let it TerminateBackroundWorker(my_bgw_handle) its self.

Of those, just changing the meaning of the exit code seems simpler and
easier. It's not clear to me why it appears to be contentious.

I don't think the status quo, with no way to exit a dynamic bgworker w/o
an error, is OK. It's like those delightful "Error: Success" messages
one gets when using perror() inappropriately - deeply confusing to
users. Lets try not to be stuck with that when we can avoid it.

--
Craig Ringer http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Craig Ringer 2014-04-17 00:46:50 Re: BGWorkers, shared memory pointers, and postmaster restart
Previous Message Craig Ringer 2014-04-17 00:24:45 Re: Buildfarm "master-next" branch? (was: Dynamic Shared Memory stuff)