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

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

On Mon, Aug 10, 2020 at 8:46 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andy Fan 2020-08-11 02:43:23 Can I test Extended Query in core test framework
Previous Message Smith, Peter 2020-08-11 01:38:08 RE: Libpq support to connect to standby server as priority