Re: Interrupts vs signals
Heikki Linnakangas <hlinnaka@iki.fi>
From: Heikki Linnakangas <hlinnaka@iki.fi>
To: Andres Freund <andres@anarazel.de>
Cc: Thomas Munro <thomas.munro@gmail.com>,
Michael Paquier <michael@paquier.xyz>, Robert Haas <robertmhaas@gmail.com>,
Fujii Masao <masao.fujii@gmail.com>,
pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2026-02-13T17:11:52Z
Lists: pgsql-hackers
Attachments
- 0001-Ignore-SIGINT-in-walwriter-and-walsummarizer.patch (text/x-patch) patch 0001
- 0002-Centralize-resetting-SIGCHLD-handler.patch (text/x-patch) patch 0002
- 0003-Use-standard-die-handler-for-SIGTERM-in-bgworkers.patch (text/x-patch) patch 0003
- 0004-Refactor-how-some-aux-processes-advertise-their-Proc.patch (text/x-patch) patch 0004
- 0005-Replace-Latches-with-Interrupts.patch (text/x-patch) patch 0005
On 29/01/2026 03:05, Heikki Linnakangas wrote: > Here's a new rebased and massively re-worked patch. > > The patches are split differently than in the previous version: > - Patches 0001-0005 are just refactoring around recovery conflicts which > I posted on a separate thread [1]. Please review and comment there. > - Patches 0006 and 0007 are small cleanups that could be applied early > (after updating the docs, as noted in TODO comment there). > - All the interesting bits for this thread are in the last, massive patch. > > To review this, I suggest starting from the new src/backend/ipc/ > README.md file. It gives a good overview of the mechanism (or if it > doesn't, that's valuable feedback :-) ). It also contains a bunch of > Open Questions at the bottom; I'd love to hear opinions and ideas on those. New version attached. Lots of little cleanups, and a few more notable changes: - Switched to 64-bit interrupt masks. This gives more headroom for extensions to reserve their own custom interrupts - I mostly gave up on sending interrupts from postmaster to child processes. So postmaster still uses kill() to tell child processes to exit or do other things. There's a TODO section in the README about that, but this is fine for now. - Implemented a RequestAddinInterrupt() function for extensions to request interrupt bits. (TODO: use it in one of the example extensions, to show how to use it and to test that it works) > On 15/07/2025 18:50, Andres Freund wrote: >>> @@ -205,6 +206,8 @@ StartupProcExit(int code, Datum arg) >>> /* Shutdown the recovery environment */ >>> if (standbyState != STANDBY_DISABLED) >>> ShutdownRecoveryTransactionEnvironment(); >>> + >>> + ProcGlobal->startupProc = INVALID_PROC_NUMBER; >>> } >> >> >> What if we instead had a ProcGlobal->auxProc[auxproxtype]? We have >> different >> versions of this for different types auf aux processes, which doesn't >> really >> make sense. > > I like that idea, but didn't try it yet. The attached patches move a little in that direction. There's no array like that, but I moved the responsibility of setting those startupProc/walreceiverProc/checkpointerProc fields to InitAuxiliaryProcess(), so there's now a clear pattern to copy if other processes need to be advertised like that. - Heikki
Commits
-
Ignore SIGINT in walwriter and walsummarizer
- a92b809f9da1 19 (unreleased) landed
-
Split WaitEventSet functions to separate source file
- 393e0d231405 18.0 landed
-
Use ModifyWaitEvent to update exit_on_postmaster_death
- 84e5b2f07a5e 18.0 landed
-
Remove unused ShutdownLatchSupport() function
- a98e4dee63ce 18.0 landed
-
Rename two functions that wake up other processes
- 368d8270c838 18.0 landed
-
Use ProcNumbers instead of direct Latch pointers to address other procs
- a9c546a5a378 18.0 landed
-
Clean up WaitLatch calls that passed latch without WL_LATCH_SET
- f9ecb57a506a 18.0 landed
-
Remove unneeded #include
- 094ae071605d 18.0 landed
-
Remove unused latch
- 6c0c49f7d37d 18.0 landed
-
Remove support for background workers without BGWORKER_SHMEM_ACCESS.
- 80a8f95b3bca 15.0 cited