Re: Adding REPACK [concurrently]

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Antonin Houska <ah(at)cybertec(dot)at>
Cc: Srinath Reddy Sadipiralla <srinath2133(at)gmail(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Mihail Nikalayeu <mihailnikalayeu(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-03 19:31:48
Message-ID: 202604031922.t6lgu5a2alwo@alvherre.pgsql
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2026-Apr-03, Alvaro Herrera wrote:

> - I polished the patch to reserve replication slots for REPACK. Given
> the new implementation of 0006 that was submitted implies that we can
> now run multiple repacks concurrently, I changed the default of 1 to 5.

Srinath let me know that this new part was causing CI failures on
Windows. This version v51 should be okay (or, at least, it passes for
me on CI). Additional changes worth mentioning:

- I think it's nicer for the index_create() API to get a bit to indicate
suppression of progress reporting; so existing callers don't need to
do anything. I guess this is mostly a matter of taste.

- I incorporated Srinath's fix for the PreventInTransactionBlock block.

- When CheckSlotRequirements() is to complain about
"max_replication_slots or max_repack_replication_slots", it seems
actually nicer to say exactly which one of these is the cause of the
problem. This is easy to change; patch 0010 does it; it requires
passing down a "repack" flag all the way from
CheckLogicalDecodingRequirements() and it needs to add an argument to
CreateInitDecodingContext(), which is perhaps not so great. On the
whole I'm inclined to do it anyway, but I'm about equally happy to
leave it alone. This is what would change:

original:
ereport(ERROR,
- (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
- errmsg("replication slots can only be used if \"%s\" > 0 or \"%s\" > 0",
- "max_replication_slots", "max_repack_replication_slots")));

patched:
ereport(ERROR,
+ errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+ errmsg("replication slots can only be used if \"%s\" > 0",
+ repack ? "max_repack_replication_slots" : "max_replication_slots"));

--
Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/
"This is a foot just waiting to be shot" (Andrew Dunstan)

Attachment Content-Type Size
v51-0001-Make-index_concurrently_create_copy-more-general.patch text/x-diff 6.4 KB
v51-0002-Rename-cluster.c-h-repack.c-h.patch text/x-diff 7.8 KB
v51-0003-Add-CONCURRENTLY-option-to-REPACK-command.patch text/x-diff 174.0 KB
v51-0004-Fix-a-few-problems-in-index-build-progress-repor.patch text/x-diff 7.4 KB
v51-0005-invert-meaning-of-index_create-flag-bit.patch text/x-diff 4.1 KB
v51-0006-Error-out-any-process-that-would-block-at-REPACK.patch text/x-diff 12.8 KB
v51-0007-Check-for-transaction-block-early-in-ExecRepack.patch text/x-diff 3.0 KB
v51-0008-Introduce-an-option-to-make-logical-replication-.patch text/x-diff 16.2 KB
v51-0009-Reserve-replication-slots-specifically-for-REPAC.patch text/x-diff 21.7 KB
v51-0010-CheckLogicalDecodingRequirements-be-specific-abo.patch text/x-diff 9.0 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andreas Karlsson 2026-04-03 19:35:44 Re: Docs: Distinguish table and index storage parameters in CREATE TABLE
Previous Message Daniel Gustafsson 2026-04-03 19:29:02 Re: Changing the state of data checksums in a running cluster