pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Use pgstat_kind_infos to read fixed shared statistics
Date: Mon, 01 Jul 2024 05:27:06 +0000
Message-ID: <E1sO9ZB-003kWY-MN@gemulon.postgresql.org> (raw)

Use pgstat_kind_infos to read fixed shared statistics

Shared statistics with a fixed number of objects are read from the stats
file in pgstat_read_statsfile() using members of PgStat_ShmemControl and
following an order based on their PgStat_Kind value.

Instead of being explicit, this commit changes the stats read to iterate
over the pgstat_kind_infos array to find the memory locations to read
into, based on a new shared_ctl_off in PgStat_KindInfo that can be used
to define the position of this stats kind in shared memory.  This makes
the read logic simpler, and eases the introduction of future
improvements aimed at making this area more pluggable for external
modules.

Original idea suggested by Andres Freund.

Author: Tristan Partin
Reviewed-by: Andres Freund, Michael Paquier
Discussion: https://postgr.es/m/D12SQ7OYCD85.20BUVF3DWU5K7@neon.tech

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/9004abf6206e815d25b7b763c756cf97b457f3cd

Modified Files
--------------
src/backend/utils/activity/pgstat.c | 74 ++++++++++++++++++-------------------
src/include/utils/pgstat_internal.h |  6 +++
2 files changed, 42 insertions(+), 38 deletions(-)



Message-ID: <E1sO9ZB-003kWY-MN@gemulon.postgresql.org>
Permalink:  ../E1sO9ZB-003kWY-MN@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1sO9ZB-003kWY-MN@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: michael@paquier.xyz, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Use pgstat_kind_infos to read fixed shared statistics
  In-Reply-To: <E1sO9ZB-003kWY-MN@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