From 790fbda902093c71ae47bff1414799cd716abb80 Mon Sep 17 00:00:00 2001 From: Fujii Masao Date: Tue, 11 Jan 2022 23:19:59 +0900 Subject: Enhance pg_log_backend_memory_contexts() for auxiliary processes. Previously pg_log_backend_memory_contexts() could request to log the memory contexts of backends, but not of auxiliary processes such as checkpointer. This commit enhances the function so that it can also send the request to auxiliary processes. It's useful to look at the memory contexts of those processes for debugging purpose and better understanding of the memory usage pattern of them. Note that pg_log_backend_memory_contexts() cannot send the request to logger or statistics collector. Because this logging request mechanism is based on shared memory but those processes aren't connected to that. Author: Bharath Rupireddy Reviewed-by: Vignesh C, Kyotaro Horiguchi, Fujii Masao Discussion: https://postgr.es/m/CALj2ACU1nBzpacOK2q=a65S_4+Oaz_rLTsU1Ri0gf7YUmnmhfQ@mail.gmail.com --- src/backend/postmaster/interrupt.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/backend/postmaster/interrupt.c') diff --git a/src/backend/postmaster/interrupt.c b/src/backend/postmaster/interrupt.c index b3db4f2a4c1..3f412dad2e6 100644 --- a/src/backend/postmaster/interrupt.c +++ b/src/backend/postmaster/interrupt.c @@ -22,6 +22,7 @@ #include "storage/latch.h" #include "storage/procsignal.h" #include "utils/guc.h" +#include "utils/memutils.h" volatile sig_atomic_t ConfigReloadPending = false; volatile sig_atomic_t ShutdownRequestPending = false; @@ -43,6 +44,10 @@ HandleMainLoopInterrupts(void) if (ShutdownRequestPending) proc_exit(0); + + /* Perform logging of memory contexts of this process */ + if (LogMemoryContextPending) + ProcessLogMemoryContextInterrupt(); } /* -- cgit v1.2.3