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:
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user