pgsql: Generate pg_stat_get*() functions for tables using macros

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Generate pg_stat_get*() functions for tables using macros
Date: 2022-12-06 01:54:52
Message-ID: E1p2NAZ-002Art-Fh@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Generate pg_stat_get*() functions for tables using macros

The same code pattern is repeated 17 times for int64 counters (0 for
missing entry) and 5 times for timestamps (NULL for missing entry) on
table entries. This code is switched to use a macro for the basic code
instead, shaving a few hundred lines of originally-duplicated code. The
function names remain the same, but some fields of PgStat_StatTabEntry
have to be renamed to cope with the new style.

Author: Bertrand Drouvot
Reviewed-by: Nathan Bossart
Discussion: https:/postgr.es/m/20221204173207.GA2669116@nathanxps13

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/83a1a1b56645b7a55ec00e44f8018116ee87c720

Modified Files
--------------
src/backend/access/heap/README.HOT | 2 +-
src/backend/postmaster/autovacuum.c | 6 +-
src/backend/utils/activity/pgstat_relation.c | 50 +--
src/backend/utils/adt/pgstatfuncs.c | 457 ++++++---------------------
src/include/pgstat.h | 20 +-
5 files changed, 139 insertions(+), 396 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message David Rowley 2022-12-06 11:10:09 pgsql: Fix 32-bit build dangling pointer issue in WindowAgg
Previous Message Alexander Korotkov 2022-12-06 00:29:33 pgsql: Check the snapshot argument of index_beginscan and family