Re: Clear padding in PgStat_HashKey keys

2024-11-04 Thread Michael Paquier
On Mon, Nov 04, 2024 at 10:07:37AM +, Bertrand Drouvot wrote: > On Mon, Nov 04, 2024 at 06:49:04PM +0900, Michael Paquier wrote: >> but if we do for the sake of a bug fix, >> which is always a possibility as ABI does not matter much for this >> internal structure, that's potentially trouble wai

Re: Clear padding in PgStat_HashKey keys

2024-11-04 Thread Bertrand Drouvot
Hi, On Mon, Nov 04, 2024 at 06:49:04PM +0900, Michael Paquier wrote: > On Mon, Nov 04, 2024 at 08:52:04AM +, Bertrand Drouvot wrote: > > Yeah, but not only the relfilenode ones. All kinds were affected as random > > data > > was in the padding bytes for all of them. > > A quick test where I

Re: Clear padding in PgStat_HashKey keys

2024-11-04 Thread Michael Paquier
On Mon, Nov 04, 2024 at 08:52:04AM +, Bertrand Drouvot wrote: > Yeah, but not only the relfilenode ones. All kinds were affected as random > data > was in the padding bytes for all of them. A quick test where I add some padding junk in PgStat_HashKey proves that you are right. I'm wondering

Re: Clear padding in PgStat_HashKey keys

2024-11-04 Thread Bertrand Drouvot
Hi, On Mon, Nov 04, 2024 at 04:25:00PM +0900, Michael Paquier wrote: > On Sun, Nov 03, 2024 at 04:25:41AM +, 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 str

Re: Clear padding in PgStat_HashKey keys

2024-11-04 Thread Bertrand Drouvot
Hi, On Mon, Nov 04, 2024 at 09:27:43AM +0100, Jelte Fennema-Nio wrote: > On Mon, 4 Nov 2024 at 08:25, Michael Paquier wrote: > > Perhaps it would be simpler to use a {0} like anywhere else for > > PgStat_HashKey in pgstat_fetch_entry() and pgstat_drop_entry(), then > > initialize the individual f

Re: Clear padding in PgStat_HashKey keys

2024-11-04 Thread Jelte Fennema-Nio
On Mon, 4 Nov 2024 at 08:25, Michael Paquier wrote: > Perhaps it would be simpler to use a {0} like anywhere else for > PgStat_HashKey in pgstat_fetch_entry() and pgstat_drop_entry(), then > initialize the individual fields? {0} doesn't clear padding, it only sets all the fields to 0. So in many

Re: Clear padding in PgStat_HashKey keys

2024-11-03 Thread Michael Paquier
On Sun, Nov 03, 2024 at 04:25:41AM +, 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 ra

Clear padding in PgStat_HashKey keys

2024-11-02 Thread Bertrand Drouvot
ov 2024 14:21:18 + Subject: [PATCH v1] Clear padding in PgStat_HashKey keys PgStat_HashKey keys are currently initialized in a way that could result in random data in the padding bytes (if there was padding in PgStat_HashKey which is not the case currently). We are using sizeof(PgSta