Re: background worker shudown (was Re: [HACKERS] Why does logical replication launcher exit with exit code 1?)

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: background worker shudown (was Re: [HACKERS] Why does logical replication launcher exit with exit code 1?)
Date: 2018-10-11 03:04:33
Message-ID: CA+Tgmob7JAcdTNPQVUVHK6scUH_-bXE=0eu7T5nPYmzRLbf0dQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Oct 10, 2018 at 12:00 AM Thomas Munro
<thomas(dot)munro(at)enterprisedb(dot)com> wrote:
> So I suppose we should just remove it, with something like 0002. I'm
> a bit uneasy about existing code out there that might be not calling
> CFI. OTOH I suspect that a lot of code copied worker_spi.c and
> installed its own handler.

I agree -- I think worker_spi.c has probably been copied a lot, and
that's not a good thing.

> Maybe src/test/modules/worker_spi.c shouldn't use approach #1 (even if
> it might technically be OK for that code)? I think I might have been
> guilty of copying that.

+1. It's not *really* OK unless all of the SQL queries it executes
are super-short and can't possibly block ... which I guess is never
really true of any SQL queries, right?

> > Maybe we could replace this by a general-purpose hook. So instead of
> > the various tests for process types that are there now, we would just
> > have
> >
> > if (procdie_hook != NULL)
> > (*procdie_hook)();
> >
> > And that hook can do whatever you like (but probably including dying).
>
> Ok, patch 0001 is a sketch like that, for discussion.

I was assuming that we'd replace the existing message-selection logic
with customer proc-die handlers. Also, I think we should not indicate
in the comments that the handler is expected to proc_exit() or
ereport(FATAL), because you might want to do something else there,
then return and let the usual thing happen.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2018-10-11 03:06:39 Re: executor relation handling
Previous Message Imai, Yoshikazu 2018-10-11 03:00:21 RE: Small performance tweak to run-time partition pruning