diff options
author | Michael Paquier | 2024-09-05 07:05:21 +0000 |
---|---|---|
committer | Michael Paquier | 2024-09-05 07:05:21 +0000 |
commit | 1b373aed20e61e4a3033e1e396e4ba7c2a96bc20 (patch) | |
tree | 6d2311110471eb4adb465a6d92c59dc02081204d /src/include | |
parent | 341e9a05e7b4c4fb2a1e539a5073dfd0e5b46735 (diff) |
Add callback for backend initialization in pgstats
pgstat_initialize() is currently used by the WAL stats as a code path to
take some custom actions when a backend starts. A callback is added to
generalize the concept so as all stats kinds can do the same, for
builtin and custom kinds, if set.
Reviewed-by: Bertrand Drouvot, Kyotaro Horiguchi
Discussion: https://postgr.es/m/ZtZr1K4PLdeWclXY@paquier.xyz
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/utils/pgstat_internal.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/include/utils/pgstat_internal.h b/src/include/utils/pgstat_internal.h index fb132e439dc..25820cbf0a6 100644 --- a/src/include/utils/pgstat_internal.h +++ b/src/include/utils/pgstat_internal.h @@ -230,6 +230,12 @@ typedef struct PgStat_KindInfo uint32 pending_size; /* + * Perform custom actions when initializing a backend (standalone or under + * postmaster). Optional. + */ + void (*init_backend_cb) (void); + + /* * For variable-numbered stats: flush pending stats. Required if pending * data is used. */ @@ -673,9 +679,9 @@ extern void pgstat_slru_snapshot_cb(void); */ extern bool pgstat_flush_wal(bool nowait); -extern void pgstat_init_wal(void); extern bool pgstat_have_pending_wal(void); +extern void pgstat_wal_init_backend_cb(void); extern void pgstat_wal_init_shmem_cb(void *stats); extern void pgstat_wal_reset_all_cb(TimestampTz ts); extern void pgstat_wal_snapshot_cb(void); |