Re: Adding REPACK [concurrently]
Antonin Houska <ah@cybertec.at>
From: Antonin Houska <ah@cybertec.at>
To: Mihail Nikalayeu <mihailnikalayeu@gmail.com>
Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>,
Fujii Masao <masao.fujii@gmail.com>, Robert Treat <rob@xzilla.net>,
Pg Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-08-27T10:11:45Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Improve REPACK (CONCURRENTLY) error messages some more
- 378dffaf8c80 19 (unreleased) landed
-
Add CONCURRENTLY option to REPACK
- 28d534e2ae0a 19 (unreleased) landed
-
Make index_concurrently_create_copy more general
- 33bf7318f94c 19 (unreleased) landed
-
Document the 'command' column of pg_stat_progress_repack
- a630ac5c2016 19 (unreleased) landed
-
Introduce the REPACK command
- ac58465e0618 19 (unreleased) landed
-
Split vacuumdb to create vacuuming.c/h
- c4067383cb2c 19 (unreleased) landed
-
Revert changes to CONCURRENTLY that "sped up" Xmin advance
- 042b584c7f7d 14.4 cited
Mihail Nikalayeu <mihailnikalayeu@gmail.com> wrote: > > A new kind of snapshot seems like (much) cleaner solution at the moment. > > Do you mean some kind of snapshot which only uses > TransactionIdDidCommit/Abort ignoring > TransactionIdIsCurrentTransactionId/TransactionIdIsInProgress? > Actually it behaves like SnapshotBelieveEverythingCommitted in that > particular case, but TransactionIdDidCommit/Abort may be used as some > kind of assert/error source to be sure everything is going as > designed. Given that there should be no (sub)transaction aborts in the new table, I think you only need to check that the tuple has valid xmin and invalid xmax. I think the XID should be in the commit log at the time the transaction is being replayed, so it should be legal to use TransactionIdDidCommit/Abort in Assert() statements. (And as long as REPACK CONCURRENTLY will use ShareUpdateExclusiveLock, which conflicts with VACUUM, pg_class(relfrozenxid) for given table should not advance during the processing, and therefore the replayed XIDs should not be truncated from the commit log while REPACK CONCURRENTLY is running.) > And, yes, for the new snapshot we need to have > HeapTupleSatisfiesUpdate to be modified. > > Also, to deal with that particular race we may just use > XactLockTableWait(xid, NULL, NULL, XLTW_None) before starting > transaction replay. Do you mean the race related to TransactionIdIsInProgress()? Not sure I understand, as you suggested above that you no longer need the function. > > No rush. First, the MVCC safety is not likely to be included in v19 [1]. > > That worries me - it is not the behaviour someone expects from a > database by default. At least the warning should be much more visible > and obvious. > I think most of user will expect the same guarantees as [CREATE|RE] > INDEX CONCURRENTLY provides. It does not really worry me. The pg_squeeze extension is not MVCC-safe and I remember there were only 1 or 2 related complaints throughout its existence. (pg_repack isn't MVCC-safe as well, but I don't keep track of its issues.) Of course, user documentation should warn about the problem, in a way it does for other commands (typically ALTER TABLE). -- Antonin Houska Web: https://www.cybertec-postgresql.com