Re: Clear padding in PgStat_HashKey keys

From: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Clear padding in PgStat_HashKey keys
Date: 2024-11-04 08:52:04
Message-ID: ZyiLNDeO9zm2LUW6@ip-10-97-1-34.eu-west-3.compute.internal
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Mon, Nov 04, 2024 at 04:25:00PM +0900, Michael Paquier wrote:
> On Sun, Nov 03, 2024 at 04:25:41AM +0000, Bertrand Drouvot wrote:
> > We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
> > hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
> > input: this lead to unexpected results if the keys contain random data in the
> > padding bytes.
>
> So you've seen that your patch was behaving weirdly once you have
> added padding because the hash key size has been extended, leading to
> relfilenode entries not being fetched when they should, right?

Yeah, but not only the relfilenode ones. All kinds were affected as random data
was in the padding bytes for all of them.

Regards,

--
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Gustafsson 2024-11-04 09:11:35 Re: [PoC] Federated Authn/z with OAUTHBEARER
Previous Message Bertrand Drouvot 2024-11-04 08:48:56 Re: Clear padding in PgStat_HashKey keys