pgsql: Allow old WAL recycling during REPACK CONCURRENTLY

Started by Alvaro Herrera6 months ago1 messagescommitters
Jump to latest
#1Alvaro Herrera
alvherre@kurilemu.de

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.fnst@fujitsu.com>
Reviewed-by: Antonin Houska <ah@cybertec.at>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>

Discussion: /messages/by-id/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(-)