Обсуждение: pgsql: Use pgstat_kind_infos to write fixed shared statistics

Поиск
Список
Период
Сортировка

pgsql: Use pgstat_kind_infos to write fixed shared statistics

От
Michael Paquier
Дата:
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

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/b68b29bc8feca0eb340cb857ff1d28d4099c7878

Modified Files
--------------
src/backend/utils/activity/pgstat.c | 56 ++++++++++++-------------------------
src/include/utils/pgstat_internal.h |  6 ++++
2 files changed, 24 insertions(+), 38 deletions(-)