Assign "backend" type earlier during process start-up
Álvaro Herrera <alvherre@kurilemu.de>
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 <euler@eulerto.com> Discussion: https://postgr.es/m/e85c6671-1600-4112-8887-f97a8a5d07b2@app.fastmail.com
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/postmaster/autovacuum.c | modified | +0 −2 |
| src/backend/postmaster/bgworker.c | modified | +0 −1 |
| src/backend/postmaster/bgwriter.c | modified | +0 −1 |
| src/backend/postmaster/checkpointer.c | modified | +0 −1 |
| src/backend/postmaster/launch_backend.c | modified | +3 −0 |
| src/backend/postmaster/pgarch.c | modified | +0 −1 |
| src/backend/postmaster/startup.c | modified | +0 −1 |
| src/backend/postmaster/syslogger.c | modified | +0 −1 |
| src/backend/postmaster/walsummarizer.c | modified | +0 −1 |
| src/backend/postmaster/walwriter.c | modified | +0 −1 |
| src/backend/replication/logical/slotsync.c | modified | +0 −2 |
| src/backend/replication/walreceiver.c | modified | +0 −1 |
| src/backend/storage/aio/method_worker.c | modified | +0 −1 |
| src/backend/tcop/backend_startup.c | modified | +1 −2 |
| src/backend/utils/error/elog.c | modified | +6 −1 |
Discussion
- log_min_messages per backend type 54 messages · 2024-12-17 → 2026-02-11