public inbox for [email protected]
help / color / mirror / Atom feedFrom: Álvaro Herrera <[email protected]>
To: [email protected]
Subject: pgsql: Assign "backend" type earlier during process start-up
Date: Wed, 04 Feb 2026 17:36:13 +0000
Message-ID: <[email protected]> (raw)
Assign "backend" type earlier during process start-up
Instead of assigning the backend type in the Main function of each
postmaster child, do it right after fork(), by which time it is already
known by postmaster_child_launch(). This reduces the time frame during
which MyBackendType is incorrect.
Before this commit, ProcessStartupPacket would overwrite MyBackendType
to B_BACKEND for dead-end backends, which is quite dubious. Stop that.
We may now see MyBackendType == B_BG_WORKER before setting up
MyBgworkerEntry. As far as I can see this is only a problem if we try
to log a message and %b is in log_line_prefix, so we now have a constant
string to cover that case. Previously, it would print "unrecognized",
which seems strictly worse.
Author: Euler Taveira <[email protected]>
Discussion: https://postgr.es/m/[email protected]
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/0c8e082fba8d36434552d3d7800abda54acafd57
Modified Files
--------------
src/backend/postmaster/autovacuum.c | 2 --
src/backend/postmaster/bgworker.c | 1 -
src/backend/postmaster/bgwriter.c | 1 -
src/backend/postmaster/checkpointer.c | 1 -
src/backend/postmaster/launch_backend.c | 3 +++
src/backend/postmaster/pgarch.c | 1 -
src/backend/postmaster/startup.c | 1 -
src/backend/postmaster/syslogger.c | 1 -
src/backend/postmaster/walsummarizer.c | 1 -
src/backend/postmaster/walwriter.c | 1 -
src/backend/replication/logical/slotsync.c | 2 --
src/backend/replication/walreceiver.c | 1 -
src/backend/storage/aio/method_worker.c | 1 -
src/backend/tcop/backend_startup.c | 3 +--
src/backend/utils/error/elog.c | 7 ++++++-
15 files changed, 10 insertions(+), 17 deletions(-)
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected]
Subject: Re: pgsql: Assign "backend" type earlier during process start-up
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox