pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Extend PgStat_HashKey.objid from 4 to 8 bytes
Date: Wed, 18 Sep 2024 03:48:20 +0000
Message-ID: <E1sqlfw-001awU-Dv@gemulon.postgresql.org> (raw)

Extend PgStat_HashKey.objid from 4 to 8 bytes

This opens the possibility to define keys for more types of statistics
kinds in PgStat_HashKey, the first case being 8-byte query IDs for
statistics like pg_stat_statements.

This increases the size of PgStat_HashKey from 12 to 16 bytes, while
PgStatShared_HashEntry, entry stored in the dshash for pgstats, keeps
the same size due to alignment.

xl_xact_stats_item, that tracks the stats items to drop in commit WAL
records, is increased from 12 to 16 bytes.  Note that individual chunks
in commit WAL records should be multiples of sizeof(int), hence 8-byte
object IDs are stored as two uint32, based on a suggestion from Heikki
Linnakangas.

While on it, the field of PgStat_HashKey is renamed from "objoid" to
"objid", as for some stats kinds this field does not refer to OIDs but
just IDs, like for replication slot stats.

This commit bumps the following format variables:
- PGSTAT_FILE_FORMAT_ID, as PgStat_HashKey is written to the stats file
for non-serialized stats kinds in the dshash table.
- XLOG_PAGE_MAGIC for the changes in xl_xact_stats_item.
- Catalog version, for the SQL function pg_stat_have_stats().

Reviewed-by: Bertrand Drouvot
Discussion: https://postgr.es/m/ZsvTS9EW79Up8I62@paquier.xyz

Branch
------
master

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

Modified Files
--------------
src/backend/access/rmgrdesc/xactdesc.c             |  7 ++--
src/backend/catalog/system_functions.sql           |  2 +-
src/backend/utils/activity/pgstat.c                | 42 ++++++++++++----------
src/backend/utils/activity/pgstat_replslot.c       |  8 ++---
src/backend/utils/activity/pgstat_shmem.c          | 21 +++++------
src/backend/utils/activity/pgstat_xact.c           | 33 +++++++++--------
src/backend/utils/adt/pgstatfuncs.c                |  4 +--
src/include/access/xact.h                          |  8 ++++-
src/include/access/xlog_internal.h                 |  2 +-
src/include/catalog/catversion.h                   |  2 +-
src/include/catalog/pg_proc.dat                    |  2 +-
src/include/pgstat.h                               |  6 ++--
src/include/utils/pgstat_internal.h                | 24 +++++++------
.../modules/injection_points/injection_stats.c     |  4 +--
src/test/recovery/t/029_stats_restart.pl           |  4 +--
src/test/regress/expected/stats.out                |  2 +-
src/test/regress/sql/stats.sql                     |  2 +-
17 files changed, 98 insertions(+), 75 deletions(-)



Message-ID: <E1sqlfw-001awU-Dv@gemulon.postgresql.org>
Permalink:  ../E1sqlfw-001awU-Dv@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1sqlfw-001awU-Dv@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: michael@paquier.xyz, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Extend PgStat_HashKey.objid from 4 to 8 bytes
  In-Reply-To: <E1sqlfw-001awU-Dv@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox