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 <[email protected]>
Reviewed-by: Antonin Houska <[email protected]>
Reviewed-by: Amit Kapila <[email protected]>

Discussion: 
https://postgr.es/m/ty4pr01mb17718b44164522d0798f8e89894...@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(-)

Reply via email to