Re: Issue with cancel_before_shmem_exit while searching to remove a particular registered exit callbacks - Mailing list pgsql-hackers

From Robert Haas
Subject Re: Issue with cancel_before_shmem_exit while searching to remove a particular registered exit callbacks
Date
Msg-id CA+TgmobSwOUTonpKUKaVLiK2XGLw4OcVn+hyffJKBNbZcJpACw@mail.gmail.com
Whole thread Raw
In response to Re: Issue with cancel_before_shmem_exit while searching to remove a particular registered exit callbacks  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Issue with cancel_before_shmem_exit while searching to remove a particular registered exit callbacks  (Michael Paquier <michael@paquier.xyz>)
List pgsql-hackers
On Mon, Aug 10, 2020 at 8:46 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> 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?

That split dates to the parallel query work, and there are some
comments in shmem_exit() about it; see in particular the explanation
in the middle where it says "Call dynamic shared memory callbacks." It
seemed to me that I needed the re-entrancy behavior that is described
there, but for a set of callbacks that needed to run before some of
the existing callbacks and after others.

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



pgsql-hackers by date:

Previous
From: "Smith, Peter"
Date:
Subject: RE: Libpq support to connect to standby server as priority
Next
From: Andy Fan
Date:
Subject: Can I test Extended Query in core test framework