mirror of
https://github.com/postgres/postgres.git
synced 2025-07-26 01:22:12 +03:00
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
This commit is contained in:
@ -50,6 +50,7 @@
|
||||
#include "storage/shmem.h"
|
||||
#include "storage/spin.h"
|
||||
#include "utils/guc.h"
|
||||
#include "utils/memutils.h"
|
||||
#include "utils/ps_status.h"
|
||||
|
||||
|
||||
@ -861,8 +862,9 @@ pgarch_die(int code, Datum arg)
|
||||
* Interrupt handler for WAL archiver process.
|
||||
*
|
||||
* This is called in the loops pgarch_MainLoop and pgarch_ArchiverCopyLoop.
|
||||
* It checks for barrier events and config update, but not shutdown request
|
||||
* because how to handle shutdown request is different between those loops.
|
||||
* It checks for barrier events, config update and request for logging of
|
||||
* memory contexts, but not shutdown request because how to handle
|
||||
* shutdown request is different between those loops.
|
||||
*/
|
||||
static void
|
||||
HandlePgArchInterrupts(void)
|
||||
@ -875,4 +877,8 @@ HandlePgArchInterrupts(void)
|
||||
ConfigReloadPending = false;
|
||||
ProcessConfigFile(PGC_SIGHUP);
|
||||
}
|
||||
|
||||
/* Perform logging of memory contexts of this process */
|
||||
if (LogMemoryContextPending)
|
||||
ProcessLogMemoryContextInterrupt();
|
||||
}
|
||||
|
Reference in New Issue
Block a user