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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, 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:46:02
Message-ID: 3354159.1597106762@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andres Freund <andres(at)anarazel(dot)de> writes:
> 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.

It's certainly arguable that PG_ENSURE_ERROR_CLEANUP is a special
snowflake and needs to use a separate mechanism. What is not real clear
to me is why there are any other callers that must use before_shmem_exit
rather than on_shmem_exit --- IOW, except for P_E_E_C's use, I have never
been persuaded that the former callback list should exist at all. The
expectation for on_shmem_exit is that callbacks correspond to system
service modules that are initialized in a particular order, and can safely
be torn down in the reverse order. Why can't the existing callers just
make even-later entries into that same callback list?

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message James Coleman 2020-08-11 01:26:26 Re: remove spurious CREATE INDEX CONCURRENTLY wait
Previous Message Andres Freund 2020-08-11 00:41:36 Re: Add LWLock blocker(s) information