Re: Issue with cancel_before_shmem_exit while searching to remove a particular registered exit callbacks

From: Andres Freund <andres(at)anarazel(dot)de>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Issue with cancel_before_shmem_exit while searching to remove a particular registered exit callbacks
Date: 2020-08-11 00:11:02
Message-ID: 20200811001102.bwcwmrwgirxyec6i@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2020-08-10 15:50:19 -0400, Robert Haas wrote:
> On Mon, Aug 10, 2020 at 3:41 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> > > What I do think we should do, after thinking about it more,
> > > is discourage the casual use of before_shmem_exit() for things where
> > > on_shmem_exit() or on_proc_exit() would be just as good. I think
> > > that's what would avoid the most problems here.
> >
> > I think we're mostly in violent agreement here. The interesting
> > question seems to be Andres' one about whether before_shmem_exit
> > actually has any safe use except for PG_ENSURE_ERROR_CLEANUP.
> > It may not, in which case perhaps we oughta rename it?

> If we could eliminate the other places where it's used, that'd be
> great. That's not too clear to me, though, because of the above two
> cases.

I think there's two different aspects here: Having before_shmem_exit(),
and having cancel_before_shmem_exit(). We could just not have the
latter, and instead use a separate list for PG_ENSURE_ERROR_CLEANUP
internally. With the callback for PG_ENSURE_ERROR_CLEANUP calling those
from its private list. There's no other uses of
cancel_before_shmem_exit afaict.

I guess alternatively we at some point might just need a more complex
callback system, where one can specify where in relation to another
callback a callback needs to be registered etc.

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2020-08-11 00:21:34 Re: Hybrid Hash/Nested Loop joins and caching results from subplans
Previous Message Alvaro Herrera 2020-08-10 23:41:20 Re: remove spurious CREATE INDEX CONCURRENTLY wait