aboutsummaryrefslogtreecommitdiff
path: root/src/include/utils/pgstat_internal.h
diff options
context:
space:
mode:
authorMichael Paquier <michael@paquier.xyz>2024-07-09 10:27:12 +0900
committerMichael Paquier <michael@paquier.xyz>2024-07-09 10:27:12 +0900
commitb68b29bc8feca0eb340cb857ff1d28d4099c7878 (patch)
treeea1d2cbb1340aa7b74df5790278a6693dc22ef66 /src/include/utils/pgstat_internal.h
parentc048cd992c69ed20acbd9059763735e51781e95a (diff)
downloadpostgresql-b68b29bc8feca0eb340cb857ff1d28d4099c7878.tar.gz
postgresql-b68b29bc8feca0eb340cb857ff1d28d4099c7878.zip
Use pgstat_kind_infos to write fixed shared statistics
This is similar to 9004abf6206e, but this time for the write part of the stats file. The code is changed so as, rather than referring to individual members of PgStat_Snapshot in an order based on their PgStat_Kind value, a loop based on pgstat_kind_infos is used to retrieve the contents to write from the snapshot structure, for a size of PgStat_KindInfo's shared_data_len. This requires the addition to PgStat_KindInfo of an offset to track the location of each fixed-numbered stats in PgStat_Snapshot. This change is useful to make this area of the code more easily pluggable, and reduces the knowledge of specific fixed-numbered kinds in pgstat.c. Reviewed-by: Bertrand Drouvot Discussion: https://postgr.es/m/Zot5bxoPYdS7yaoy@paquier.xyz
Diffstat (limited to 'src/include/utils/pgstat_internal.h')
-rw-r--r--src/include/utils/pgstat_internal.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/include/utils/pgstat_internal.h b/src/include/utils/pgstat_internal.h
index e21ef4e2c98..43d6deb03cf 100644
--- a/src/include/utils/pgstat_internal.h
+++ b/src/include/utils/pgstat_internal.h
@@ -200,6 +200,12 @@ typedef struct PgStat_KindInfo
uint32 shared_size;
/*
+ * The offset of the statistics struct in the cached statistics snapshot
+ * PgStat_Snapshot, for fixed-numbered statistics.
+ */
+ uint32 snapshot_ctl_off;
+
+ /*
* The offset of the statistics struct in the containing shared memory
* control structure PgStat_ShmemControl, for fixed-numbered statistics.
*/