| From: | Tomas Vondra <tomas(at)vondra(dot)me> |
|---|---|
| To: | Lukas Fittl <lukas(at)fittl(dot)com> |
| Cc: | Peter Geoghegan <pg(at)bowt(dot)ie>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: Parallel GIN, BRIN builds fail to maintain ii_BrokenHotChain |
| Date: | 2026-11-20 10:04:52 |
| Message-ID: | 714dae3f-2d6a-46c4-ae4c-61c8cba1695d@vondra.me |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On 11/20/26 03:54, Lukas Fittl wrote:
> Hi,
>
> On Thu, Nov 19, 2026 at 5:56 PM Tomas Vondra <tomas(at)vondra(dot)me> wrote:
>>
>> On 11/20/26 01:46, Peter Geoghegan wrote:
>>> My LLM produced the attached patch, which adds an isolation test
>>> showing that parallel index builds of both GIN and BRIN indexes fail
>>> to maintain ii_BrokenHotChain correctly. The test fails, demonstrating
>>> incorrect results.
>>>
>>> The underlying bug is straightforward: both GIN and BRIN lack the
>>> required handling. If any individual parallel worker sets
>>> ii_BrokenHotChain, then it has to be passed on to the leader so that
>>> pg_index.indcheckxmin gets set correctly. Otherwise, older snapshots
>>> can use the index even though it isn't guaranteed to have index tuples
>>> for every row version that the snapshot can still see. nbtree gets
>>> this right, but that precedent seems to have been missed.
>>>
>>
>> Thanks for noticing it, and for the reproducer. I'll get it fixed
>> (unless you want to take care of that).
>
> I actually ran into the exact same issue and reported it over at [0]
> together with a refactoring to prevent problems like this from
> happening in the future. pgvector had the same issue and Andrew fixed
> it recently based on that report [1].
>
> For easier reference, attached the v2 patch from here that fixes that
> specific issue as 0002, together with Peter's isolation test
> reproducer from v1 kept as 0001. This now passes the test for me
> locally.
>
> [0]: https://www.postgresql.org/message-id/flat/CAP53PkxEZPeT_G7u-1qF-%3DouBvMxUNka-bN7cJowkv7gms9uCg%40mail.gmail.com#4fb55830a8fdca424c618a66837d1b0d
> [1]: https://github.com/pgvector/pgvector/commit/9f973cd95f5ac3aab6ccb8ebdfb048188e4025e4
>
> Thanks,
> Lukas
>
Thanks. That is very helpful, I'll use it for my fix.
regards
--
Tomas Vondra
| From | Date | Subject | |
|---|---|---|---|
| Previous Message | Tomas Vondra | 2026-11-20 09:46:17 | Re: A bug in recovery prefetcher, triggering asserts / FATAL: checkpoint request failed |