Re: Bug in huge simplehash
Yura Sokolov <y.sokolov@postgrespro.ru>
From: Yura Sokolov <y.sokolov@postgrespro.ru>
To: Ranier Vilela <ranier.vf@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>, Andres Freund
<andres@anarazel.de>, Tomas Vondra <tomas.vondra@2ndquadrant.com>
Date: 2021-08-10T12:10:49Z
Lists: pgsql-hackers
Attachments
- v2-0001-Fix-new-size-and-sizemask-computaton-in-simplehash.h.patch (text/x-diff) patch v2-0001
Ranier Vilela писал 2021-08-10 14:21: > Em ter., 10 de ago. de 2021 às 05:53, Yura Sokolov > <y.sokolov@postgrespro.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
Commits
-
Fix incorrect hash table resizing code in simplehash.h
- 4874886b4c03 10.19 landed
- 5a6b0f21e679 11.14 landed
- 75d8fe8181e6 12.9 landed
- 4873da79da4b 13.5 landed
- dc23c77d07af 14.0 landed
- 37450f2ca9ad 15.0 landed