enhance pg_log_backend_memory_contexts() to log memory contexts of auxiliary processes - Mailing list pgsql-hackers

From Bharath Rupireddy
Subject enhance pg_log_backend_memory_contexts() to log memory contexts of auxiliary processes
Date
Msg-id CALj2ACU1nBzpacOK2q=a65S_4+Oaz_rLTsU1Ri0gf7YUmnmhfQ@mail.gmail.com
Whole thread Raw
Responses Re: enhance pg_log_backend_memory_contexts() to log memory contexts of auxiliary processes  (torikoshia <torikoshia@oss.nttdata.com>)
List pgsql-hackers
Hi,

Currently pg_log_backend_memory_contexts() doesn't log the memory
contexts of auxiliary processes such as bgwriter, checkpointer, wal
writer, archiver, startup process and wal receiver. It will be useful
to look at the memory contexts of these processes too, for debugging
purposes and better understanding of the memory usage pattern of these
processes. Inside the code, we could use the AuxiliaryPidGetProc() to
get the PGPROC of these processes. Note that, neither
AuxiliaryPidGetProc() nor BackendPidGetProc() can return PGPROC(as
they don't have PGPROC entries at all) entries for the syslogger,
stats collector processes.

Open points:
1) I'm not sure if it's a good idea to log postmaster memory usage
too. Thoughts?
2) Since with this change pg_log_backend_memory_contexts() will work
for auxiliary processes too, do we need to change the function name
from pg_log_backend_memory_contexts() to
pg_log_backend_memory_contexts()/pg_log_memory_contexts()/some other
name? Or is it a good idea to have a separate function for auxiliary
processes alone, pg_log_auxilliary_process_memory_contexts()?
Thoughts?

I will attach the patch, if possible with test cases, once we agree on
the above open points.

Regards,
Bharath Rupireddy.



pgsql-hackers by date:

Previous
From: Bharath Rupireddy
Date:
Subject: Inconsistency in startup process's MyBackendId and procsignal array registration with ProcSignalInit()
Next
From: Bharath Rupireddy
Date:
Subject: Re: Fix pg_log_backend_memory_contexts() 's delay