pgsql: Allow old WAL recycling during REPACK CONCURRENTLY

From: Álvaro Herrera <alvherre(at)kurilemu(dot)de>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Allow old WAL recycling during REPACK CONCURRENTLY
Date: 2026-05-29 22:23:55
Message-ID: E1wT5cQ-000BD0-2K@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Allow old WAL recycling during REPACK CONCURRENTLY

During REPACK CONCURRENTLY, logical decoding keeps replication
slot.restart_lsn pinned behind the oldest running transaction, which is
often the long-lived REPACK transaction itself. As a result, old WAL
segments are retained longer than necessary.

This commit advances the replication slot each time WAL insertion
crosses a segment boundary, so obsolete WAL files can be recycled while
REPACK is still running.

Author: Zhijie Hou <houzj(dot)fnst(at)fujitsu(dot)com>
Reviewed-by: Antonin Houska <ah(at)cybertec(dot)at>
Reviewed-by: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>

Discussion: https://postgr.es/m/TY4PR01MB17718B44164522D0798F8E898940A2@TY4PR01MB17718.jpnprd01.prod.outlook.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/45b02984e2fa9ee7bd83f7e58797b160baf0cc13

Modified Files
--------------
src/backend/commands/repack_worker.c | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Andrew Dunstan 2026-05-30 01:59:04 pgsql: Apply encoding conversion in COPY TO FORMAT JSON
Previous Message Jacob Champion 2026-05-29 21:44:41 pgsql: doc: Correct the timeline for OAuth's shutdown_cb