Re: bt_index_parent_check and concurrently build indexes

Álvaro Herrera <alvherre@kurilemu.de>

From: Álvaro Herrera <alvherre@kurilemu.de>
To: Donghang Lin <donghanglin@gmail.com>
Cc: Mihail Nikalayeu <mihailnikalayeu@gmail.com>, Peter Geoghegan <pg@bowt.ie>, Michael Paquier <michael@paquier.xyz>, PostgreSQL Hackers <pgsql-hackers@postgresql.org>, Andrey Borodin <amborodin86@gmail.com>, Matthias van de Meent <boekewurm+postgres@gmail.com>
Date: 2025-12-05T10:44:10Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. amcheck: Fix snapshot usage in bt_index_parent_check

  2. Teach contrib/amcheck to check the unique constraint violation

Attachments

Hello,

On 2025-Dec-04, Donghang Lin wrote:

> Hi Álvaro,
> 
> Thanks for looking at it. The test in the commit still fails back to 14.
> I think it should be backported to 14 and up.

You're correct that the bug is older.  I'm not sure about backporting
the fix to 16 and earlier though, because it depends on BtreeCheckState
having the snapshot member which was only added in commit 5ae2087202af.
It's not a difficult patch -- attached.

I was being cautious and under the impression that the bug had never
been actually encountered by users, but I just noticed that in your
reply from 2 Jun 2025 you mentioned hitting this problem.  So maybe we
should bite the bullet ...

Is anybody against backpatching this to 14-16?

(One thing I realized is that the comment for BtreeCheckState->snapshot
says that it's used for the uniqueness test only, but that's no longer
the case.  So that needs fixed ...)

-- 
Álvaro Herrera        Breisgau, Deutschland  —  https://www.EnterpriseDB.com/