Andres Freund <andres@anarazel.de> writes:
> It's the lock-upgrade problem I theorized about
> upthread. ReindexIndex(), via RangeVarCallbackForReindexIndex(), takes a
> ShareLock on pg_class, and then goes on to upgrade to RowExclusiveLock
> in RelationSetNewRelfilenode(). But at that time another session
> obviously can already have the ShareLock and would also want to upgrade.
Hmm. Note that this is totally independent of the deadlock mechanism
I reported in my last message on this thread.
I also wonder whether clobber-cache testing would expose cases
we haven't seen that trace to the additional catalog accesses
caused by cache reloads.
> I'm not sure it's worth fixing this.
I am not sure it's even *possible* to fix all these cases. Even
if we could, it's out of scope for v12 let alone the back branches.
I think the only practical solution is to remove those reindex tests.
Even if we ran them in a script with no concurrent scripts, there'd
be risk of failures against autovacuum, I'm afraid. Not often, but
often enough to be annoying.
Possibly we could run them in a TAP test that configures a cluster
with autovac disabled?
regards, tom lane