]> git.ipfire.org Git - thirdparty/postgresql.git/commit
pgstat: revise replication slot API in preparation for shared memory stats.
authorAndres Freund <andres@anarazel.de>
Thu, 7 Apr 2022 01:26:17 +0000 (18:26 -0700)
committerAndres Freund <andres@anarazel.de>
Thu, 7 Apr 2022 01:38:24 +0000 (18:38 -0700)
commite41aed674f35c63380175bb0e2dfa8dccfb2204d
tree2df5379b72989cd9c77a50fa9f4e995fed7e1e89
parent8b1dccd37c71ed2ff016294d8f9053a32b02b19e
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
src/backend/postmaster/pgstat.c
src/backend/replication/logical/logical.c
src/backend/replication/slot.c
src/backend/utils/activity/pgstat_replslot.c
src/include/pgstat.h
src/include/replication/slot.h