Re: bt_index_parent_check and concurrently build indexes

From: Donghang Lin <donghanglin(at)gmail(dot)com>
To: Álvaro Herrera <alvherre(at)kurilemu(dot)de>
Cc: Mihail Nikalayeu <mihailnikalayeu(at)gmail(dot)com>, Peter Geoghegan <pg(at)bowt(dot)ie>, Michael Paquier <michael(at)paquier(dot)xyz>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Andrey Borodin <amborodin86(at)gmail(dot)com>, Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>
Subject: Re: bt_index_parent_check and concurrently build indexes
Date: 2025-12-06 17:29:00
Message-ID: CAA=D8a3cWCzipBh1hq0ADkEk-PbRbmN6xyBtiz7hLMBume13-Q@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Álvaro

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.
>

The issue itself in fact doesn't depend on BtreeCheckState's
snapshot member.
So the fix for 14-16 can make snapshot a local variable in
the bt_check_every_level
function to make the scope small. Do you think it's worth changing it to a
local variable?

I don't think the issue itself is related to 5ae2087202af but actually
7f563c09f890 where
the heapallindexed flag is introduced for bt_index_check. The committed test
also doesn't check the uniqueness of an index. Should the commit message be
restated
to reflect this and also restate it's backport to 14 and up?

I applied the patch in 14 and noticed that it needs to fix the test number
to get the test passed.
15 and 16 do not need this diff.
-use Test::More tests => 3;
+use Test::More tests => 4;

> (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 ...)
>

I think we'll have another chance to reflect that the issue is since
7f563c09f890 but not 5ae2087202af
in master for this fix. I can give it a try.

Thanks,
Donghang

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message 河田達也 2025-12-06 17:39:45 [PATCH] Add sampling statistics to autoanalyze log output
Previous Message Tomas Vondra 2025-12-06 16:39:31 Re: increased duration of stats_ext tests with -DCLOBBER_CACHE_ALWAYS