[PATCH] ProcessInterrupts_hook - Mailing list pgsql-hackers

From Craig Ringer
Subject [PATCH] ProcessInterrupts_hook
Date
Msg-id CAGRY4nzm+=ZBkWDaBXPQeHGqd5xAc4ukUR+Ph2mEeqj1j5ycRQ@mail.gmail.com
Whole thread Raw
Responses Re: [PATCH] ProcessInterrupts_hook  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
Hi folks

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()

So here's a simple patch to add ProcessInterrupts_hook. It follows the usual pattern like ProcessUtility_hook and standard_ProcessUtility.

Why? Because sometimes I want most of the behaviour of die(), but the option to override it with some bgworker-specific choices occasionally. HOLD_INTERRUPTS() is too big a hammer.

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. Copies in shmem only obviously. But I'm not convinced it's right to just copy these vars as-is to shmem, and I don't want to use the memory for a ProcSignal slot for something that won't be relevant for most backends for most of the postmaster lifetime. Ideas welcomed.

Attachment

pgsql-hackers by date:

Previous
From: Luc Vlaming
Date:
Subject: Re: New Table Access Methods for Multi and Single Inserts
Next
From: Bharath Rupireddy
Date:
Subject: Re: Narrow the scope of the variable outputstr in logicalrep_write_tuple