diff options
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/catalog/catversion.h | 2 | ||||
-rw-r--r-- | src/include/catalog/pg_proc.dat | 6 | ||||
-rw-r--r-- | src/include/miscadmin.h | 1 | ||||
-rw-r--r-- | src/include/nodes/memnodes.h | 6 | ||||
-rw-r--r-- | src/include/storage/procsignal.h | 1 | ||||
-rw-r--r-- | src/include/utils/memutils.h | 5 |
6 files changed, 17 insertions, 4 deletions
diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h index 7eaca64b559..613823c6ee8 100644 --- a/src/include/catalog/catversion.h +++ b/src/include/catalog/catversion.h @@ -53,6 +53,6 @@ */ /* yyyymmddN */ -#define CATALOG_VERSION_NO 202104051 +#define CATALOG_VERSION_NO 202104061 #endif diff --git a/src/include/catalog/pg_proc.dat b/src/include/catalog/pg_proc.dat index 69ffd0c3f4d..73c22c8b4df 100644 --- a/src/include/catalog/pg_proc.dat +++ b/src/include/catalog/pg_proc.dat @@ -7946,6 +7946,12 @@ proargnames => '{name, ident, parent, level, total_bytes, total_nblocks, free_bytes, free_chunks, used_bytes}', prosrc => 'pg_get_backend_memory_contexts' }, +# logging memory contexts of the specified backend +{ oid => '4543', descr => 'log memory contexts of the specified backend', + proname => 'pg_log_backend_memory_contexts', + provolatile => 'v', prorettype => 'bool', + proargtypes => 'int4', prosrc => 'pg_log_backend_memory_contexts' }, + # non-persistent series generator { oid => '1066', descr => 'non-persistent series generator', proname => 'generate_series', prorows => '1000', diff --git a/src/include/miscadmin.h b/src/include/miscadmin.h index 6f8251e0b07..95202d37af5 100644 --- a/src/include/miscadmin.h +++ b/src/include/miscadmin.h @@ -84,6 +84,7 @@ extern PGDLLIMPORT volatile sig_atomic_t ProcDiePending; extern PGDLLIMPORT volatile sig_atomic_t IdleInTransactionSessionTimeoutPending; extern PGDLLIMPORT volatile sig_atomic_t IdleSessionTimeoutPending; extern PGDLLIMPORT volatile sig_atomic_t ProcSignalBarrierPending; +extern PGDLLIMPORT volatile sig_atomic_t LogMemoryContextPending; extern PGDLLIMPORT volatile sig_atomic_t CheckClientConnectionPending; extern PGDLLIMPORT volatile sig_atomic_t ClientConnectionLost; diff --git a/src/include/nodes/memnodes.h b/src/include/nodes/memnodes.h index 9331ef80fd9..e6a757d6a07 100644 --- a/src/include/nodes/memnodes.h +++ b/src/include/nodes/memnodes.h @@ -52,7 +52,8 @@ typedef struct MemoryContextCounters */ typedef void (*MemoryStatsPrintFunc) (MemoryContext context, void *passthru, - const char *stats_string); + const char *stats_string, + bool print_to_stderr); typedef struct MemoryContextMethods { @@ -66,7 +67,8 @@ typedef struct MemoryContextMethods bool (*is_empty) (MemoryContext context); void (*stats) (MemoryContext context, MemoryStatsPrintFunc printfunc, void *passthru, - MemoryContextCounters *totals); + MemoryContextCounters *totals, + bool print_to_stderr); #ifdef MEMORY_CONTEXT_CHECKING void (*check) (MemoryContext context); #endif diff --git a/src/include/storage/procsignal.h b/src/include/storage/procsignal.h index 4ae7dc33b8e..eec186be2ee 100644 --- a/src/include/storage/procsignal.h +++ b/src/include/storage/procsignal.h @@ -34,6 +34,7 @@ typedef enum PROCSIG_PARALLEL_MESSAGE, /* message from cooperating parallel backend */ PROCSIG_WALSND_INIT_STOPPING, /* ask walsenders to prepare for shutdown */ PROCSIG_BARRIER, /* global barrier interrupt */ + PROCSIG_LOG_MEMORY_CONTEXT, /* ask backend to log the memory contexts */ /* Recovery conflict reasons */ PROCSIG_RECOVERY_CONFLICT_DATABASE, diff --git a/src/include/utils/memutils.h b/src/include/utils/memutils.h index 36aae4e51c8..ff872274d44 100644 --- a/src/include/utils/memutils.h +++ b/src/include/utils/memutils.h @@ -84,7 +84,8 @@ extern MemoryContext MemoryContextGetParent(MemoryContext context); extern bool MemoryContextIsEmpty(MemoryContext context); extern Size MemoryContextMemAllocated(MemoryContext context, bool recurse); extern void MemoryContextStats(MemoryContext context); -extern void MemoryContextStatsDetail(MemoryContext context, int max_children); +extern void MemoryContextStatsDetail(MemoryContext context, int max_children, + bool print_to_stderr); extern void MemoryContextAllowInCriticalSection(MemoryContext context, bool allow); @@ -144,6 +145,8 @@ extern void MemoryContextCreate(MemoryContext node, MemoryContext parent, const char *name); +extern void HandleLogMemoryContextInterrupt(void); +extern void ProcessLogMemoryContextInterrupt(void); /* * Memory-context-type-specific functions |