Re: Bug in huge simplehash

From: Yura Sokolov <y(dot)sokolov(at)postgrespro(dot)ru>
To: Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Andres Freund <andres(at)anarazel(dot)de>, Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>
Subject: Re: Bug in huge simplehash
Date: 2021-08-10 12:10:49
Message-ID: c900cc323249dfdecb2a151c8aa4b579@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Ranier Vilela писал 2021-08-10 14:21:
> Em ter., 10 de ago. de 2021 às 05:53, Yura Sokolov
> <y(dot)sokolov(at)postgrespro(dot)ru> escreveu:
>
>>
>> I went to check SH_GROW and.... It is `SH_GROW(SH_TYPE *tb, uint32
>> newsize)`
>> :-(((
>> Therefore when `tb->size == SH_MAX_SIZE/2` and we call `SH_GROW(tb,
>> tb->size * 2)`,
>> then SH_GROW(tb, 0) is called due to truncation.
>> And SH_COMPUTE_PARAMETERS is also accepts `uint32 newsize`.
>>
>> Ahh... ok, patch is updated to fix this as well.
>
> It seems that we need to fix the function prototype too.
>
> /* void <prefix>_grow(<prefix>_hash *tb) */
> -SH_SCOPE void SH_GROW(SH_TYPE * tb, uint32 newsize); +SH_SCOPE void
> SH_GROW(SH_TYPE * tb, uint64 newsize);

Ahh... Thank you, Ranier.
Attached v2.

regards,

-----

Yura Sokolov

Attachment Content-Type Size
v2-0001-Fix-new-size-and-sizemask-computaton-in-simplehash.h.patch text/x-diff 2.0 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2021-08-10 12:20:14 Re: WIP: System Versioned Temporal Table
Previous Message Drouvot, Bertrand 2021-08-10 11:59:57 Re: [bug] Logical Decoding of relation rewrite with toast does not reset toast_hash