pgsql: pgstat: revise replication slot API in preparation for shared me - Mailing list pgsql-committers

From Andres Freund
Subject pgsql: pgstat: revise replication slot API in preparation for shared me
Date
Msg-id E1ncHYo-000fJt-Bj@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
pgstat: revise replication slot API in preparation for shared memory stats.

Previously the pgstat <-> replication slots API was done with on the basis of
names. However, the upcoming move to storing stats in shared memory makes it
more convenient to use a integer as key.

Change the replication slot functions to take the slot rather than the slot
name, and expose ReplicationSlotIndex() to compute the index of an replication
slot. Special handling will be required for restarts, as the index is not
stable across restarts. For now pgstat internally still uses names.

Rename pgstat_report_replslot_{create,drop}() to
pgstat_{create,drop}_replslot() to match the functions for other kinds of
stats.

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/e41aed674f35c63380175bb0e2dfa8dccfb2204d

Modified Files
--------------
src/backend/postmaster/pgstat.c              | 10 +++++++++-
src/backend/replication/logical/logical.c    |  2 +-
src/backend/replication/slot.c               | 20 ++++++++++++++++++--
src/backend/utils/activity/pgstat_replslot.c | 13 ++++++++-----
src/include/pgstat.h                         |  7 ++++---
src/include/replication/slot.h               |  1 +
6 files changed, 41 insertions(+), 12 deletions(-)


pgsql-committers by date:

Previous
From: Andres Freund
Date:
Subject: pgsql: pgstat: prepare APIs used by pgstatfuncs for shared memory stats
Next
From: Amit Kapila
Date:
Subject: pgsql: Reorder subskiplsn in pg_subscription to avoid alignment issues.