pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andres Freund <andres@anarazel.de>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: pgstat: prepare APIs used by pgstatfuncs for shared memory stats
Date: Thu, 07 Apr 2022 00:57:04 +0000
Message-ID: <E1ncGSN-000emw-L7@gemulon.postgresql.org> (raw)

pgstat: prepare APIs used by pgstatfuncs for shared memory stats.

With the introduction of PgStat_Kind PgStat_Single_Reset_Type,
PgStat_Shared_Reset_Target don't make sense anymore. Replace them with
PgStat_Kind.

Instead of having dedicated reset functions for different kinds of stats, use
two generic helper routines (one to reset all stats of a kind, one to reset
one stats entry).

A number of reset functions were named pgstat_reset_*_counter(), despite
affecting multiple counters. The generic helper routines get rid of
pgstat_reset_single_counter(), pgstat_reset_subscription_counter().

Rename pgstat_reset_slru_counter(), pgstat_reset_replslot_counter() to
pgstat_reset_slru(), pgstat_reset_replslot() respectively, and have them only
deal with a single SLRU/slot. Resetting all SLRUs/slots goes through the
generic pgstat_reset_of_kind().

Previously pg_stat_reset_replication_slot() used SearchNamedReplicationSlot()
to check if a slot exists. API wise it seems better to move that to
pgstat_replslot.c.

This is done separately from the - quite large - shared memory statistics
patch to make review easier.

Reviewed-By: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Discussion: https://postgr.es/m/20220404041516.cctrvpadhuriawlq@alap3.anarazel.de

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/8fb580a35ce358063dfdd10991d017498283c767

Modified Files
--------------
src/backend/postmaster/pgstat.c                  | 128 ++++++++++++++++-------
src/backend/utils/activity/pgstat_replslot.c     |  37 +++++--
src/backend/utils/activity/pgstat_slru.c         |   8 +-
src/backend/utils/activity/pgstat_subscription.c |  21 ----
src/backend/utils/adt/pgstatfuncs.c              |  68 ++++++------
src/include/pgstat.h                             |  28 ++---
src/tools/pgindent/typedefs.list                 |   2 -
7 files changed, 161 insertions(+), 131 deletions(-)



Message-ID: <E1ncGSN-000emw-L7@gemulon.postgresql.org>
Permalink:  ../E1ncGSN-000emw-L7@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1ncGSN-000emw-L7@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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: andres@anarazel.de
  Subject: Re: pgsql: pgstat: prepare APIs used by pgstatfuncs for shared memory stats
  In-Reply-To: <E1ncGSN-000emw-L7@gemulon.postgresql.org>
  References: <E1ncGSN-000emw-L7@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