pgsql: Use WaitEventSet API for postmaster's event loop.

From: Thomas Munro <tmunro(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Use WaitEventSet API for postmaster's event loop.
Date: 2023-01-12 03:44:26
Message-ID: E1pFoVu-003E30-9H@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Use WaitEventSet API for postmaster's event loop.

Switch to a design similar to regular backends, instead of the previous
arrangement where signal handlers did non-trivial state management and
called fork(). The main changes are:

* The postmaster now has its own local latch to wait on. (For now, we
don't want other backends setting its latch directly, but that could
probably be made to work with more research on robustness.)

* The existing signal handlers are cut in two: a handle_pm_XXX() part
that just sets pending_pm_XXX flags and the latch, and a
process_pm_XXX() part that runs later when the latch is seen.

* Signal handlers are now installed with the regular pqsignal()
function rather than the special pqsignal_pm() function; historical
portability concerns about the effect of SA_RESTART on select() are no
longer relevant, and we don't need to block signals anymore.

Reviewed-by: Andres Freund <andres(at)anarazel(dot)de>
Discussion: https://postgr.es/m/CA%2BhUKG%2BZ-HpOj1JsO9eWUP%2Bar7npSVinsC_npxSy%2BjdOMsx%3DGg%40mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/7389aad63666a2cac18cd6d7496378d7f50ef37b

Modified Files
--------------
src/backend/libpq/pqcomm.c | 3 +-
src/backend/libpq/pqsignal.c | 40 ----
src/backend/postmaster/fork_process.c | 18 +-
src/backend/postmaster/postmaster.c | 418 ++++++++++++++++++++--------------
src/backend/tcop/postgres.c | 1 -
src/backend/utils/init/miscinit.c | 13 +-
src/include/libpq/pqsignal.h | 3 -
src/include/miscadmin.h | 1 +
8 files changed, 269 insertions(+), 228 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2023-01-12 04:01:31 pgsql: Revert "Get rid of the "new" and "old" entries in a view's range
Previous Message Tom Lane 2023-01-12 03:20:10 pgsql: Doc: fix silly thinko in 8bf6ec3ba.