Re: amcheck: add index-all-keys-match verification for B-Tree

From: Andrey Borodin <x4mmm(at)yandex-team(dot)ru>
To: Jakub Wartak <jakub(dot)wartak(at)enterprisedb(dot)com>
Cc: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Wenbo Lin <linwenbo1994(at)gmail(dot)com>
Subject: Re: amcheck: add index-all-keys-match verification for B-Tree
Date: 2026-11-08 07:23:12
Message-ID: 83FEA711-31BD-4F26-9E9C-BFDE606D9030@yandex-team.ru
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Jakub,

On 5 Oct 2026, Jakub Wartak wrote:
> still follows LP_REDIRECT/HOT

The two-step fetch reaches the visible tuple behind both an unpruned HOT
chain and LP_REDIRECT. Our registered MVCC snapshot prevents that tuple
from being pruned between the calls. The comparison keeps the original
indexed TID. I added an explicit error if the second fetch fails.

The new tests exercise Bloom misses by changing an indexed expression after
a HOT update. Replacing the chain lookup with a direct fetch of the
original TID makes the checker miss those changed keys.

PFA v7 with your API fixup folded into 0001 and the old 0002/0003 merged.
On the cached-size question, smgrnblocks_cached() uses InRecovery.
I left the cache alone and checked a persistent standby connection across
replay of heap/index extension.

There are now LP_UNUSED and out-of-range offset tests, plus an LP_DEAD
case which must pass. With --with-segsize-blocks=4, the lost-segment test
detects plain and posting-list references both with and without
indexallkeysmatch.

The docs now state the cost of the additional full heap scan and describe
the unconditional EOF check separately. The existing TOAST and short
varlena regression cases now run with the new check enabled.

Thank you!

Best regards, Andrey Borodin.

Attachment Content-Type Size
v7-0001-amcheck-add-indexallkeysmatch-verification-for-B-.patch application/octet-stream 35.1 KB
v7-0002-amcheck-detect-dangling-B-Tree-references-to-heap.patch application/octet-stream 17.7 KB
v7-0003-doc-describe-indexallkeysmatch-verification.patch application/octet-stream 7.7 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Osama Abdul Qader 2026-11-08 07:39:21 Re: Avoid using raw xmin of frozen tuples in logicalrep conflict detection
Previous Message Zhijie Hou 2026-11-08 07:15:01 Re: Parallel Apply