Re: Switch PgStat_HashKey.objoid from Oid to uint64

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
Cc: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Switch PgStat_HashKey.objoid from Oid to uint64
Date: 2024-09-12 22:34:21
Message-ID: ZuNsbZEUN5K6Aon8@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Sep 12, 2024 at 01:37:52PM +0000, Bertrand Drouvot wrote:
> There is also some manipulation around the 2 new uint32 fields (objid_hi and
> objid_lo) in the xactdesc.c and pgstat_xact.c files that look good to me.

Thanks for the reviews. The high and low manipulations are still kind
of OK to me as a solution for the record constructions.

> But now we end up having functions that accept Oid as parameters to call
> functions that accept uint64 as parameter (for the exact same parameter), for
> example:
>
> "
> void
> pgstat_create_function(Oid proid)
> {
> pgstat_create_transactional(PGSTAT_KIND_FUNCTION,
> MyDatabaseId,
> proid);
> }
> "
>
> as pgstat_create_transactional is now:
>
> -pgstat_create_transactional(PgStat_Kind kind, Oid dboid, Oid objoid)
> +pgstat_create_transactional(PgStat_Kind kind, Oid dboid, uint64 objid)
>
> That's not an issue as both are unsigned and as we do those calls in that
> order (Oid -> uint64).

Yes, that's intentional. All the pgstats routines associated to a
particular object that depends on an OID should still use an OID, and
anything that's generic enough to be used for all stats kinds had
better use a uint64. I was wondering if it would be better hiding
that behind a dedicated type, but decided to stick with uint64.
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Masahiko Sawada 2024-09-12 22:42:48 Re: pg_trgm comparison bug on cross-architecture replication due to different char implementation
Previous Message Tom Lane 2024-09-12 22:23:45 Re: Mutable foreign key constraints