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: 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-05 09:00:01
Message-ID: bc2bd0cc-4a19-b311-043f-f9a40e71dfe8@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

03.06.2023 22:00, PG Bug reporting form wrote:
> The following bug has been logged on the website:
>
> Bug reference: 17959
> Logged by: Alexander Lakhin
> Email address: exclusion(at)gmail(dot)com
> PostgreSQL version: 16beta1
> Operating system: Ubuntu 22.04
> Description:
>
> After some DDL/transactional operations (a reproducer to follow)
> pg_amcheck detects an anomaly:
> 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"

The operations that trigger that anomaly are as follows:
my $bsession1 = $node->background_psql('regress001');
$bsession1->query_safe("create temp table t1(a int)");
my $bsession2 = $node->background_psql('regress002');
$bsession2->query_safe("begin transaction");
$bsession2->query_safe("prepare transaction 'pt1'");
$bsession1->quit;
my $bsession3 = $node->background_psql('regress001');
$bsession3->query_safe("create temp table t1(a int)");
$bsession3->query_safe("vacuum t1");
$bsession2->quit;
$bsession3->quit;

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 '(?^:^$)'

Best regards,
Alexander

Attachment Content-Type Size
099_pdri_error.pl application/x-perl 2.3 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Adrien Nayrat 2023-06-05 09:54:27 Re: BUG #16739: Temporary files not deleting from data folder on disk
Previous Message Maxim Zakharov 2023-06-05 07:46:58 Re: BUG #17961: Incorrect aggregation MIN, AVG, MAX