Re: [PATCH] ProcessInterrupts_hook

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Craig Ringer <craig(dot)ringer(at)enterprisedb(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Petr Jelinek <petr(dot)jelinek(at)enterprisedb(dot)com>, Markus Wanner <markus(dot)wanner(at)enterprisedb(dot)com>
Subject: Re: [PATCH] ProcessInterrupts_hook
Date: 2021-01-18 16:56:28
Message-ID: 342709.1610988988@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> On Mon, Jan 18, 2021 at 3:00 AM Craig Ringer
> <craig(dot)ringer(at)enterprisedb(dot)com> wrote:
>> A few times lately I've been doing things in extensions that've made me want to be able to run my own code whenever InterruptPending is true and CHECK_FOR_INTERRUPTS() calls ProcessInterrupts()

> I've wanted this in the past, too, so +1 from me.

I dunno, this seems pretty scary and easily abusable. There's not all
that much that can be done safely in ProcessInterrupts(), and we should
not be encouraging extensions to think they can add random processing
there.

>> What I really want to go along with this is a way for any backend to observe the postmaster's pmState and its "Shutdown" variable's value, so any backend can tell if we're in FastShutdown, SmartShutdown, etc.

> I've wanted something along this line, too, but what I was thinking
> about was more along the lines of having the postmaster signal the
> backends when a smart shutdown happened.

We're about halfway there already, see 7e784d1dc. I didn't do the
other half because it wasn't necessary to the problem, but exposing
the shutdown state more fully seems reasonable.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2021-01-18 17:06:35 Re: Key management with tests
Previous Message Magnus Hagander 2021-01-18 16:52:47 Re: Add session statistics to pg_stat_database