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

From Mihail Nikalayeu
Subject Re: Adding REPACK [concurrently]
Date
Msg-id CADzfLwUOnargQe+rpTC5tFUOj+yNj01qJM42PAgi2CiMpZn3tw@mail.gmail.com
Whole thread
In response to Re: Adding REPACK [concurrently]  (Antonin Houska <ah@cybertec.at>)
Responses Re: Adding REPACK [concurrently]
Re: Adding REPACK [concurrently]
List pgsql-hackers
Hello!

On Wed, Apr 15, 2026 at 8:28 PM Antonin Houska <ah@cybertec.at> wrote:
> just after step 4, the two session will probably up in a deadlock anyway. In
> other words, even if REPACK does the check early, it does not prevent other
> sessions from getting in the way.
>
> Maybe I'm still missing something.

I was trying to solve that by using another approach: the ability to
define a "future lock" [0]. It is declared even before taking the
actual lock, so, no race is possible.

That approach works correctly except one case -
ShareUpdateExclusiveLock from another backend, I described it here [1]
a little bit.

For now, I don't know how to solve it without a performance downgrade.

[0]: https://github.com/michail-nikolaev/postgres/commit/ba0f4247dad3d96b8282cd18056b7776cd69317c
[1]:
https://www.postgresql.org/message-id/flat/CADzfLwU8Qw6LXFHO7Tbjc-O7o%2BtM26jdnOJBWqYLu61rf7bO%2Bg%40mail.gmail.com#1e96f8882363afb2fc53c2f08346f527



pgsql-hackers by date:

Previous
From: vignesh C
Date:
Subject: Re: Use XLogRecPtrIsValid() instead of negated XLogRecPtrIsInvalid
Next
From: Bertrand Drouvot
Date:
Subject: Re: Make copyObject work in C++