On Wed, Mar 5, 2025, at 11:53 PM, Fujii Masao wrote: > On 2025/03/05 9:33, Euler Taveira wrote: > >> > + Valid <literal>BACKENDTYPE</literal> values are > >> > <literal>ARCHIVER</literal>, > >> > + <literal>AUTOVACUUM</literal>, <literal>BACKEND</literal>, > >> > + <literal>BGWORKER</literal>, <literal>BGWRITER</literal>, > >> > + <literal>CHECKPOINTER</literal>, <literal>LOGGER</literal>, > >> > + <literal>SLOTSYNCWORKER</literal>, > >> > <literal>WALRECEIVER</literal>, > >> > + <literal>WALSENDER</literal>, <literal>WALSUMMARIZER</literal>, > >> > and > >> > + <literal>WALWRITER</literal>. > > What about postmaster?
It is B_INVALID that is currently mapped to "backend". This state is used as an initial phase for the child process. There might be messages before MyBackendType is assigned (see ProcessStartupPacket, for example). Hence, I refrain to create a special backend type for postmaster. Should we map it to generic log level instead of backend? > For parallel workers launched for parallel queries, should they follow > the backend's log level or the background worker's? Since they operate > as part of a parallel query executed by a backend, it seems more logical > for them to follow the backend's setting. Since we are using enum BackendType and there is no special entry for parallel query processes. I'm afraid that introducing conditional logic for checking special cases like the bgw_type for parallel queries or MyProcPid == PostmasterPid might slowdown that code path. (See that should_output_to_server is an inline function.) I will run some tests to see if there is a considerable impact. > + [B_CHECKPOINTER] = "checkpointer", > + [B_STARTUP] = "backend", /* XXX same as backend? */ > > I like the idea of allowing log levels to be set per process. > There were times I wanted to use debug5 specifically for > the startup process when troubleshooting WAL replay. It would be > helpful to distinguish the startup process from a regular backend, > so we can set its log level independently. Although startup process is mapped to backend (hence, the XXX), we can certainly create a separate backend type for it. -- Euler Taveira EDB https://www.enterprisedb.com/