pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Nathan Bossart <nathan@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Show size of DSAs and dshashes in pg_dsm_registry_allocations.
Date: Tue, 02 Dec 2025 16:31:25 +0000
Message-ID: <E1vQTHh-002SV9-0d@gemulon.postgresql.org> (raw)

Show size of DSAs and dshashes in pg_dsm_registry_allocations.

Presently, this view reports NULL for the size of DSAs and dshash
tables because 1) the current backend might not be attached to them
and 2) the registry doesn't save the pointers to the dsa_area or
dshash_table in local memory.  Also, the view doesn't show
partially-initialized entries to avoid ambiguity, since those
entries would report a NULL size as well.

This commit introduces a function that looks up the size of a DSA
given its handle (transiently attaching to the control segment if
needed) and teaches pg_dsm_registry_allocations to use it to show
the size of successfully-initialized DSA and dshash entries.
Furthermore, the view now reports partially-initialized entries
with a NULL size.

Reviewed-by: Rahila Syed <rahilasyed90@gmail.com>
Reviewed-by: Robert Haas <robertmhaas@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/aSeEDeznAsHR1_YF%40nathan

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/f894acb24a12cf1f369a45af36c8f4049f9af571

Modified Files
--------------
doc/src/sgml/system-views.sgml                     |  4 +--
src/backend/storage/ipc/dsm_registry.c             | 25 ++++++----------
src/backend/utils/mmgr/dsa.c                       | 35 ++++++++++++++++++++++
src/include/utils/dsa.h                            |  1 +
.../expected/test_dsm_registry.out                 | 12 ++++----
.../test_dsm_registry/sql/test_dsm_registry.sql    |  4 +--
6 files changed, 55 insertions(+), 26 deletions(-)



Message-ID: <E1vQTHh-002SV9-0d@gemulon.postgresql.org>
Permalink:  ../E1vQTHh-002SV9-0d@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1vQTHh-002SV9-0d@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: nathan@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Show size of DSAs and dshashes in pg_dsm_registry_allocations.
  In-Reply-To: <E1vQTHh-002SV9-0d@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox