On Mon, Jan 18, 2021 at 3:00 AM Craig Ringer <craig.rin...@enterprisedb.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. > 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. 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. After all when a fast shutdown happens the backends already get told to terminate, and that seems like it ought to be enough: I'm not sure backends have any business caring about why they are being asked to terminate. But they might well want to know whether a smart shutdown is in progress, and right now there's no way for them to know that. -- Robert Haas EDB: http://www.enterprisedb.com