aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/pgstatfuncs.c
diff options
context:
space:
mode:
authorMichael Paquier <michael@paquier.xyz>2024-09-18 12:44:15 +0900
committerMichael Paquier <michael@paquier.xyz>2024-09-18 12:44:15 +0900
commitb14e9ce7d55c75ffa160b07765eb9dffde70b5fa (patch)
tree4f4d177f99d9f755a0dd068578943afcc1035a75 /src/backend/utils/adt/pgstatfuncs.c
parentac04aa84a7f06635748278e6ff4bd74751bb3e8e (diff)
downloadpostgresql-b14e9ce7d55c75ffa160b07765eb9dffde70b5fa.tar.gz
postgresql-b14e9ce7d55c75ffa160b07765eb9dffde70b5fa.zip
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
Diffstat (limited to 'src/backend/utils/adt/pgstatfuncs.c')
-rw-r--r--src/backend/utils/adt/pgstatfuncs.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/backend/utils/adt/pgstatfuncs.c b/src/backend/utils/adt/pgstatfuncs.c
index 33c7b25560b..9c23ac7c8c8 100644
--- a/src/backend/utils/adt/pgstatfuncs.c
+++ b/src/backend/utils/adt/pgstatfuncs.c
@@ -2046,8 +2046,8 @@ pg_stat_have_stats(PG_FUNCTION_ARGS)
{
char *stats_type = text_to_cstring(PG_GETARG_TEXT_P(0));
Oid dboid = PG_GETARG_OID(1);
- Oid objoid = PG_GETARG_OID(2);
+ uint64 objid = PG_GETARG_INT64(2);
PgStat_Kind kind = pgstat_get_kind_from_str(stats_type);
- PG_RETURN_BOOL(pgstat_have_entry(kind, dboid, objoid));
+ PG_RETURN_BOOL(pgstat_have_entry(kind, dboid, objid));
}