| From: | Andres Freund <andres(at)anarazel(dot)de> |
|---|---|
| To: | Mihail Nikalayeu <mihailnikalayeu(at)gmail(dot)com> |
| Cc: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Antonin Houska <ah(at)cybertec(dot)at>, Srinath Reddy Sadipiralla <srinath2133(at)gmail(dot)com>, Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>, Pg Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Robert Treat <rob(at)xzilla(dot)net> |
| Subject: | Re: Adding REPACK [concurrently] |
| Date: | 2026-04-09 14:13:26 |
| Message-ID: | zefg3dww5q5iayo46mdiqgsewtwx3qv3jp2utzj5ucxdc7isvu@3q7szybdkmdx |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi,
On 2026-04-09 01:36:00 +0200, Mihail Nikalayeu wrote:
> Hello, Andres!
>
> On Wed, Apr 8, 2026 at 7:22 PM Andres Freund <andres(at)anarazel(dot)de> wrote:
> > I don't think this is a viable path. You need to prevent any further lock
> > acquisitions on the relation to be able to swap it, not just conflicting DDL.
>
> AFAIU, Amit's main idea is that we currently upgrade the lock instead
> of **releasing and re-acquiring** it because we fear DDL between those
> actions.
I got that, I just don't think it's going to work in any sort of way
reasonably well.
The fix here should be to make the system understand how to make lock upgrades
as safe as possible, not to hack around the corners. For that you need to
teach the deadlock detector about all of this properly.
> > I don't think CheckTableNotInUse() would work anyway - don't we already hold
> > locks by the point we call it?
>
> Yes, the DDL session already holds locks by the time
> CheckTableNotInUse is called - but is that really the problem? They
> will be released on error.
There's no guarantee they get there if it's done after the lock
acquisition. It can be part of a more complicated lock cycle.
Greetings,
Andres Freund
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Andres Freund | 2026-04-09 14:20:18 | Re: Adding REPACK [concurrently] |
| Previous Message | Mihail Nikalayeu | 2026-04-09 14:06:17 | Re: Adding REPACK [concurrently] |