1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-19 13:42:17 +03:00

Add PgStat_KindInfo.init_shmem_cb

This new callback gives fixed-numbered stats the possibility to take
actions based on the area of shared memory allocated for them.

This removes from pgstat_shmem.c any knowledge specific to the types
of fixed-numbered stats, and the initializations happen in their own
files.  Like b68b29bc8f, this change is useful to make this area of
the code more pluggable, so as custom fixed-numbered stats can take
actions after their shared memory area is initialized.

Reviewed-by: Bertrand Drouvot
Discussion: https://postgr.es/m/Zot5bxoPYdS7yaoy@paquier.xyz
This commit is contained in:
Michael Paquier
2024-07-11 09:21:40 +09:00
parent cc2236854e
commit 21471f18e9
9 changed files with 78 additions and 9 deletions

View File

@@ -62,6 +62,14 @@ pgstat_fetch_stat_archiver(void)
return &pgStatLocal.snapshot.archiver;
}
void
pgstat_archiver_init_shmem_cb(void *stats)
{
PgStatShared_Archiver *stats_shmem = (PgStatShared_Archiver *) stats;
LWLockInitialize(&stats_shmem->lock, LWTRANCHE_PGSTATS_DATA);
}
void
pgstat_archiver_reset_all_cb(TimestampTz ts)
{