Re: Adding REPACK [concurrently]

From: Mihail Nikalayeu <mihailnikalayeu(at)gmail(dot)com>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: Antonin Houska <ah(at)cybertec(dot)at>, Pg Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Robert Treat <rob(at)xzilla(dot)net>
Subject: Re: Adding REPACK [concurrently]
Date: 2026-02-02 09:17:42
Message-ID: CADzfLwUVQw+XLwurjHYBHuNdDw3mBUUM7fXxaruMt25YB6xbyQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> > I'm not sure it's acceptable to cause other sessions to raise errors if
> > they query the table being repacked (or a table repacked recently).
> > That sounds extremely unpleasant. Imagine a long-running transactions
> > that runs enormous queries for many hours or even days, being killed
> > near the end because some DBA decided to run REPACK on a table.

> It will not. It raises an error only for the case table will be "empty"
because REPACK switched to new with all tuples with REPACK xid and our
transaction treats that xid as running.

> So, there is no regression here, it just changes from "see an empty table
because of MVCC violation" to "get error" in the exact situation.
> I prefer the second.

But I agree that a MVCC-safe solution is better. But to receive the error
you need to be really unlucky (subtle race - in *first* access to a
repacked table in transaction you need to get a statement snapshot in the
moment of table swap) or use non READ-COMMITED isolation method.

So, we prevent silent READ of MVCC-violated data - I think it is enough, at
least for start.

Mikhail.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Mihail Nikalayeu 2026-02-02 09:18:01 Re: Adding REPACK [concurrently]
Previous Message shveta malik 2026-02-02 09:10:25 Re: Improve pg_sync_replication_slots() to wait for primary to advance