pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: exclusion@gmail.com
Subject: BUG #18499: Reindexing spgist index concurrently triggers Assert("TransactionIdIsValid(state->myXid)")
Date: Fri, 07 Jun 2024 11:00:00 +0000
Message-ID: <18499-8a519c280f956480@postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      18499
Logged by:          Alexander Lakhin
Email address:      exclusion@gmail.com
PostgreSQL version: 17beta1
Operating system:   Ubuntu 22.04
Description:        

The following script:
cat << EOF | psql &
CREATE TABLE t(i int, p point);
CREATE INDEX spgist_point_idx ON t USING spgist(p);

INSERT INTO t (i, p)
        SELECT g, point(g*10+1, g*10+1) FROM generate_series(1, 100000) g;
SELECT pg_sleep(1);
INSERT INTO t (i, p)
        SELECT g, point(g*10+1, g*10+1) FROM generate_series(1, 100000) g;
EOF

cat << EOF | psql
SELECT pg_sleep(1);
REINDEX INDEX CONCURRENTLY spgist_point_idx;
EOF

triggers an assertion failure with the following stack trace:
TRAP: failed Assert("TransactionIdIsValid(state->myXid)"), File:
"spgutils.c", Line: 1078, PID: 2975757

(gdb) bt
...
#5  0x00005569aefe0727 in ExceptionalCondition
(conditionName=conditionName@entry=0x5569af0562a0
"TransactionIdIsValid(state->myXid)", fileName=fileName@entry=0x5569af05636c
"spgutils.c", lineNumber=lineNumber@entry=1078)
    at assert.c:66
#6  0x00005569aeb3c344 in spgFormDeadTuple
(state=state@entry=0x7ffc3a771760, tupstate=tupstate@entry=1,
blkno=blkno@entry=0, offnum=offnum@entry=1) at spgutils.c:1078
#7  0x00005569aeb3385b in spgPageIndexMultiDelete (...) at
spgdoinsert.c:166
#8  0x00005569aeb34d90 in doPickSplit (...) at spgdoinsert.c:1177
#9  0x00005569aeb35a57 in spgdoinsert (...) at spgdoinsert.c:2139
#10 0x00005569aeb3661f in spginsert (...) at spginsert.c:206
#11 0x00005569aeb11a6d in index_insert (...) at indexam.c:230
#12 0x00005569aeb035f5 in heapam_index_validate_scan (...) at
heapam_handler.c:1963
#13 0x00005569aeb9589b in table_index_validate_scan (...) at
../../../src/include/access/tableam.h:1855
#14 validate_index (...) at index.c:3392
#15 0x00005569aec4dbeb in ReindexRelationConcurrently (...) at
indexcmds.c:4036
#16 0x00005569aec4ec05 in ReindexIndex (...) at indexcmds.c:2814
#17 0x00005569aec4efd9 in ExecReindex (...) at indexcmds.c:2743

(gdb) frame 6
(gdb) p state->myXid
$3 = 0

Without asserts enabled, REINDEX executed with no error.

Reproduced on REL_12_STABLE .. master.



view thread (7+ messages)  latest in thread

Message-ID: <18499-8a519c280f956480@postgresql.org>
Permalink:  ../18499-8a519c280f956480@postgresql.org/
Also on:    postgresql.org/message-id/18499-8a519c280f956480@postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, exclusion@gmail.com
  Subject: Re: BUG #18499: Reindexing spgist index concurrently triggers Assert("TransactionIdIsValid(state->myXid)")
  In-Reply-To: <18499-8a519c280f956480@postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox