summaryrefslogtreecommitdiff
path: root/src/test/modules
diff options
context:
space:
mode:
authorNathan Bossart <nathan@postgresql.org>2025-07-09 09:17:56 -0500
committerNathan Bossart <nathan@postgresql.org>2025-07-09 09:17:56 -0500
commit167ed8082f40ee1f3f4cd18cf02bd6d17df57dab (patch)
treeb2e1c2ab3e8b8eb6fedd68306716d752378c5c0a /src/test/modules
parentf5a987c0e5f6bbf0cc0420228dc57e7aae4d7e8f (diff)
Introduce pg_dsm_registry_allocations view.
This commit adds a new system view that provides information about entries in the dynamic shared memory (DSM) registry. Specifically, it returns the name, type, and size of each entry. Note that since we cannot discover the size of dynamic shared memory areas (DSAs) and hash tables backed by DSAs (dshashes) without first attaching to them, the size column is left as NULL for those. Bumps catversion. Author: Florents Tselai <florents.tselai@gmail.com> Reviewed-by: Sungwoo Chang <swchangdev@gmail.com> Discussion: https://postgr.es/m/4D445D3E-81C5-4135-95BB-D414204A0AB4%40gmail.com
Diffstat (limited to 'src/test/modules')
-rw-r--r--src/test/modules/test_dsm_registry/expected/test_dsm_registry.out18
-rw-r--r--src/test/modules/test_dsm_registry/sql/test_dsm_registry.sql7
2 files changed, 25 insertions, 0 deletions
diff --git a/src/test/modules/test_dsm_registry/expected/test_dsm_registry.out b/src/test/modules/test_dsm_registry/expected/test_dsm_registry.out
index 8ded82e59d6..ca8abbb377e 100644
--- a/src/test/modules/test_dsm_registry/expected/test_dsm_registry.out
+++ b/src/test/modules/test_dsm_registry/expected/test_dsm_registry.out
@@ -1,3 +1,10 @@
+SELECT name, type, size IS DISTINCT FROM 0 AS size
+FROM pg_dsm_registry_allocations
+WHERE name like 'test_dsm_registry%' ORDER BY name;
+ name | type | size
+------+------+------
+(0 rows)
+
CREATE EXTENSION test_dsm_registry;
SELECT set_val_in_shmem(1236);
set_val_in_shmem
@@ -24,3 +31,14 @@ SELECT get_val_in_hash('test');
1414
(1 row)
+\c
+SELECT name, type, size IS DISTINCT FROM 0 AS size
+FROM pg_dsm_registry_allocations
+WHERE name like 'test_dsm_registry%' ORDER BY name;
+ name | type | size
+------------------------+---------+------
+ test_dsm_registry_dsa | area | t
+ test_dsm_registry_dsm | segment | t
+ test_dsm_registry_hash | hash | t
+(3 rows)
+
diff --git a/src/test/modules/test_dsm_registry/sql/test_dsm_registry.sql b/src/test/modules/test_dsm_registry/sql/test_dsm_registry.sql
index c2e25cddaae..965a3f1ebb6 100644
--- a/src/test/modules/test_dsm_registry/sql/test_dsm_registry.sql
+++ b/src/test/modules/test_dsm_registry/sql/test_dsm_registry.sql
@@ -1,6 +1,13 @@
+SELECT name, type, size IS DISTINCT FROM 0 AS size
+FROM pg_dsm_registry_allocations
+WHERE name like 'test_dsm_registry%' ORDER BY name;
CREATE EXTENSION test_dsm_registry;
SELECT set_val_in_shmem(1236);
SELECT set_val_in_hash('test', '1414');
\c
SELECT get_val_in_shmem();
SELECT get_val_in_hash('test');
+\c
+SELECT name, type, size IS DISTINCT FROM 0 AS size
+FROM pg_dsm_registry_allocations
+WHERE name like 'test_dsm_registry%' ORDER BY name;