mirror of
https://github.com/postgres/postgres.git
synced 2025-11-24 00:23:06 +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:
@@ -84,6 +84,14 @@ pgstat_fetch_stat_checkpointer(void)
|
||||
return &pgStatLocal.snapshot.checkpointer;
|
||||
}
|
||||
|
||||
void
|
||||
pgstat_checkpointer_init_shmem_cb(void *stats)
|
||||
{
|
||||
PgStatShared_Checkpointer *stats_shmem = (PgStatShared_Checkpointer *) stats;
|
||||
|
||||
LWLockInitialize(&stats_shmem->lock, LWTRANCHE_PGSTATS_DATA);
|
||||
}
|
||||
|
||||
void
|
||||
pgstat_checkpointer_reset_all_cb(TimestampTz ts)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user