v12.0: reindex CONCURRENTLY: lock ShareUpdateExclusiveLock on object 14185/39327/0 is already held

Justin Pryzby <pryzby@telsasoft.com>

From: Justin Pryzby <pryzby@telsasoft.com>
To: pgsql-hackers@lists.postgresql.org
Cc: Michael Paquier <michael@paquier.xyz>, Peter Eisentraut <peter.eisentraut@2ndquadrant.com>, Andreas Karlsson <andreas@proxel.se>
Date: 2019-10-13T02:51:45Z
Lists: pgsql-hackers
I ran into this while trying to trigger the previously-reported segfault. 

CREATE TABLE t(i) AS SELECT * FROM generate_series(1,9);
CREATE INDEX ON t(i);

[pryzbyj@database ~]$ for i in `seq 1 9`; do PGOPTIONS='-cstatement_timeout=9' psql postgres --host /tmp --port 5678 -c "REINDEX INDEX CONCURRENTLY t_i_idx" ; done
ERROR:  canceling statement due to statement timeout
ERROR:  lock ShareUpdateExclusiveLock on object 14185/47287/0 is already held
[...]

Variations on this seem to leave the locks table (?) or something else in a
Real Bad state, such that I cannot truncate the table or drop it; or at least
commands are unreasonably delayed for minutes, on this otherwise-empty test
cluster.

Justin



Commits

  1. Fix handling of pg_class.relispartition at swap phase in REINDEX CONCURRENTLY

  2. Handle interrupts within a transaction context in REINDEX CONCURRENTLY