pgsql: Use pgstat_kind_infos to read fixed shared statistics - Mailing list pgsql-committers

From Michael Paquier
Subject pgsql: Use pgstat_kind_infos to read fixed shared statistics
Date
Msg-id E1sO9ZB-003kWY-MN@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Use pgstat_kind_infos to read fixed shared statistics

Shared statistics with a fixed number of objects are read from the stats
file in pgstat_read_statsfile() using members of PgStat_ShmemControl and
following an order based on their PgStat_Kind value.

Instead of being explicit, this commit changes the stats read to iterate
over the pgstat_kind_infos array to find the memory locations to read
into, based on a new shared_ctl_off in PgStat_KindInfo that can be used
to define the position of this stats kind in shared memory.  This makes
the read logic simpler, and eases the introduction of future
improvements aimed at making this area more pluggable for external
modules.

Original idea suggested by Andres Freund.

Author: Tristan Partin
Reviewed-by: Andres Freund, Michael Paquier
Discussion: https://postgr.es/m/D12SQ7OYCD85.20BUVF3DWU5K7@neon.tech

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/9004abf6206e815d25b7b763c756cf97b457f3cd

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


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: pgsql: Further weaken new pg_createsubscriber test on Windows.
Next
From: Peter Eisentraut
Date:
Subject: pgsql: Apply COPT to CXXFLAGS as well