Re: Adding REPACK [concurrently] - Mailing list pgsql-hackers

From Andres Freund
Subject Re: Adding REPACK [concurrently]
Date
Msg-id ikqtl3utsa3er2mfz2oyjv5ofjmlxfhtkolwh5fyfotsmykhqx@rnm3d7e46tjb
Whole thread
In response to Re: Adding REPACK [concurrently]  (Antonin Houska <ah@cybertec.at>)
Responses Re: Adding REPACK [concurrently]
List pgsql-hackers
Hi,

On 2026-04-15 16:50:11 +0200, Antonin Houska wrote:
> I thought of a "hypothetical graph", which would include the to-be-granted
> lock, but the major issue is that it will not work correctly without the
> locking the LMGR's LW locks we do in CheckDeadLock():
> 
>     for (i = 0; i < NUM_LOCK_PARTITIONS; i++)
>         LWLockAcquire(LockHashPartitionLockByIndex(i), LW_EXCLUSIVE);
> 
> And obviously, doing this each time we want to insert a lock into the queue
> would be bad for performance.

Hence my suggestion to do this as part of the deadlock check. Then we don't do
this unnecessary work outside of the case where we actually need it.

That does need to deal with the case of the deadlock check running first in
the backend doing repack, but that's not that hard - I think it'd be good
enough to set its deadlock timeout temporarily to a higher value. The backend
*should* still run the deadlock detector, because it could probably still get
into a deadlock (e.g. due to a pg_class access or something).

Greetings,

Andres Freund



pgsql-hackers by date:

Previous
From: jian he
Date:
Subject: Re: First draft of PG 19 release notes
Next
From: Ashutosh Bapat
Date:
Subject: Re: Bug: Missing collation assignment for GRAPH_TABLE COLUMNS expressions