Re: BUG #17959: amcheck fails to find a matching index tuple for an invisible heap tuple

From: Alexander Lakhin <exclusion(at)gmail(dot)com>
To: Peter Geoghegan <pg(at)bowt(dot)ie>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #17959: amcheck fails to find a matching index tuple for an invisible heap tuple
Date: 2023-06-06 03:00:00
Message-ID: 71fbc31f-51c1-92cc-594e-834dd4c4fcd9@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hello Peter,

Thanks for looking into this!

05.06.2023 19:27, Peter Geoghegan wrote:
> On Mon, Jun 5, 2023 at 2:00 AM Alexander Lakhin <exclusion(at)gmail(dot)com> wrote:
>> A complete TAP test to reproduce the issue is attached.
>> I put it in src/bin/pg_amcheck/t/, run (on master, e6a254c0d)
>> PROVE_TESTS=t/099_pdri_error.pl make -s check -C src/bin/pg_amcheck/
>> and get:
>>
>> # Failed test 'pg_amcheck after manipulations stdout /(?^:^$)/'
>> # at t/099_pdri_error.pl line 60.
>> # 'btree index "regress001.pg_catalog.pg_depend_reference_index":
>> # ERROR: heap tuple (13,35) from table "pg_depend" lacks matching index tuple within index "pg_depend_reference_index"
>> # '
>> # doesn't match '(?^:^$)'
> I can easily reproduce this result using your test case.
>
> I notice that the test case will pass if I remove your use of the
> "--rootdescend" option from your tap test script. This suggests that
> the problem is somehow limited to heapallindexed verification when run
> through the bt_index_parent_check() interface -- bt_index_check()
> heapallindexed verification seems unaffected. The former works rather
> like a CREATE INDEX internally (and so can just use SnapshotAny),
> while the latter works more like CREATE INDEX CONCURRENTLY (and so
> must use an MVCC snapshot).

Yes, I can confirm that bt_index_parent_check() calls
bt_check_every_level(... readonly = true ...) and in this case snapshot = SnapshotAny
is used.
SELECT * FROM bt_index_parent_check('pg_catalog.pg_depend_reference_index'::regclass, true, false)
gives the same error (and it looks like the parameter rootdescend of
bt_index_parent_check() doesn't affect this).

BTW, with the DEBUG2 log level I get a message:
verifying that tuples from index "pg_depend_reference_index" are present in "pg_depend"
but doesn't the verification work the other way?

Best regards,
Alexander

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Kyotaro Horiguchi 2023-06-06 05:07:49 Re: BUG #17962: postgresql 11 hangs on poly_contain with specific data
Previous Message Peter Geoghegan 2023-06-05 16:27:46 Re: BUG #17959: amcheck fails to find a matching index tuple for an invisible heap tuple