summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorFujii Masao2022-01-11 14:19:59 +0000
committerFujii Masao2022-01-11 14:19:59 +0000
commit790fbda902093c71ae47bff1414799cd716abb80 (patch)
treec880d8ea26d2b6605b3b50faa8a31bf7a80d5d3f /src/test
parent85c61ba8920ba73500e1518c63795982ee455d14 (diff)
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
Diffstat (limited to 'src/test')
-rw-r--r--src/test/regress/expected/misc_functions.out7
-rw-r--r--src/test/regress/sql/misc_functions.sql3
2 files changed, 10 insertions, 0 deletions
diff --git a/src/test/regress/expected/misc_functions.out b/src/test/regress/expected/misc_functions.out
index 1013d17f87d..e2c77d0ac84 100644
--- a/src/test/regress/expected/misc_functions.out
+++ b/src/test/regress/expected/misc_functions.out
@@ -147,6 +147,13 @@ SELECT pg_log_backend_memory_contexts(pg_backend_pid());
t
(1 row)
+SELECT pg_log_backend_memory_contexts(pid) FROM pg_stat_activity
+ WHERE backend_type = 'checkpointer';
+ pg_log_backend_memory_contexts
+--------------------------------
+ t
+(1 row)
+
CREATE ROLE regress_log_memory;
SELECT has_function_privilege('regress_log_memory',
'pg_log_backend_memory_contexts(integer)', 'EXECUTE'); -- no
diff --git a/src/test/regress/sql/misc_functions.sql b/src/test/regress/sql/misc_functions.sql
index 7ab9b2a1509..1159f6b5855 100644
--- a/src/test/regress/sql/misc_functions.sql
+++ b/src/test/regress/sql/misc_functions.sql
@@ -41,6 +41,9 @@ SELECT num_nulls();
SELECT pg_log_backend_memory_contexts(pg_backend_pid());
+SELECT pg_log_backend_memory_contexts(pid) FROM pg_stat_activity
+ WHERE backend_type = 'checkpointer';
+
CREATE ROLE regress_log_memory;
SELECT has_function_privilege('regress_log_memory',