pgsql: Generate pg_stat_get*() functions for databases 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 databases using macros
Date: 2022-12-07 00:12:12
Message-ID: E1p2i2l-002Id5-QF@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Generate pg_stat_get*() functions for databases using macros

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

This is in the same spirit as 83a1a1b.

Author: Michael Paquier
Reviewed-by: Nathan Bossart, Bertrand Drouvot
Discussion: https://postgr.es/m/Y46stlxQ2LQE20Na@paquier.xyz

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/8018ffbf5895ee16a1fd7117c4526b47ac42332e

Modified Files
--------------
src/backend/utils/activity/pgstat_database.c | 94 +++---
src/backend/utils/activity/pgstat_relation.c | 14 +-
src/backend/utils/adt/pgstatfuncs.c | 454 ++++++---------------------
src/include/pgstat.h | 54 ++--
4 files changed, 169 insertions(+), 447 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Andres Freund 2022-12-07 03:05:56 pgsql: autoconf: Move export_dynamic determination to configure
Previous Message Andres Freund 2022-12-06 19:31:25 pgsql: meson: Basic cygwin support