Partially deduplicate interrupt handling for background processes

Enterprise / PostgreSQL - Robert Haas [postgresql.org] - 17 December 2019 18:14 UTC

Where possible, share signal handler code and main loop interrupt checking. This saves quite a bit of code and should simplify maintenance, too.

This commit intends not to change the way anything works, even though that might allow more code to be unified. It does unify a bunch of individual variables into a ShutdownRequestPending flag that has is now used by a bunch of different process types, though.

Patch by me, reviewed by Andres Freund and Daniel Gustafsson.

Discussion: http://postgr.es/m/CA+TgmoZwDk=BguVDVa+qdA6SBKef=PKbaKDQALTC_9qoz1mJqg@mail.gmail.com

7dbfea3c45 Partially deduplicate interrupt handling for background processes.
src/backend/postmaster/Makefile | 1 +
src/backend/postmaster/autovacuum.c | 29 +++-----
src/backend/postmaster/bgworker.c | 25 +------
src/backend/postmaster/bgwriter.c | 93 ++-----------------------
src/backend/postmaster/checkpointer.c | 60 ++--------------
src/backend/postmaster/interrupt.c | 108 +++++++++++++++++++++++++++++
src/backend/postmaster/pgarch.c | 29 ++------
src/backend/postmaster/pgstat.c | 28 ++------
src/backend/postmaster/startup.c | 34 +--------
src/backend/postmaster/walwriter.c | 84 ++--------------------
src/backend/replication/logical/launcher.c | 3 +-
src/backend/replication/logical/worker.c | 3 +-
src/backend/replication/walreceiver.c | 31 +--------
src/backend/replication/walsender.c | 4 +-
src/backend/tcop/postgres.c | 22 +-----
src/backend/utils/init/globals.c | 1 -
src/include/miscadmin.h | 3 -
src/include/postmaster/interrupt.h | 32 +++++++++
18 files changed, 191 insertions(+), 399 deletions(-)

Upstream: git.postgresql.org


  • Share