From 611710b6ed40269e7c09c8095c5e916c5fd19417 Mon Sep 17 00:00:00 2001 From: Konstantin Knizhnik Date: Thu, 3 Jul 2025 14:15:45 +0300 Subject: [PATCH] Do not invalidate obsolete slot if on demand wal download is supported --- src/backend/replication/slot.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/backend/replication/slot.c b/src/backend/replication/slot.c index 5c90980e689..dc4ae572c5e 100644 --- a/src/backend/replication/slot.c +++ b/src/backend/replication/slot.c @@ -50,6 +50,7 @@ #include "replication/slotsync.h" #include "replication/slot.h" #include "replication/walsender_private.h" +#include "replication/logical.h" #include "replication/message.h" #include "storage/fd.h" #include "storage/ipc.h" @@ -1611,7 +1612,8 @@ InvalidatePossiblyObsoleteSlot(ReplicationSlotInvalidationCause cause, { case RS_INVAL_WAL_REMOVED: if (initial_restart_lsn != InvalidXLogRecPtr && - initial_restart_lsn < oldestLSN) + initial_restart_lsn < oldestLSN && + !Custom_XLogReaderRoutines) invalidation_cause = cause; break; case RS_INVAL_HORIZON: