From ced5045624096851658c6de00c5b8930cfea8755 Mon Sep 17 00:00:00 2001 From: Konstantin Knizhnik Date: Thu, 3 Jul 2025 14:26:01 +0300 Subject: [PATCH] Do not invalidate obsolete slot if on demand wal download is supported --- src/backend/replication/slot.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/backend/replication/slot.c b/src/backend/replication/slot.c index afb1af987a7..bf8bc09a427 100644 --- a/src/backend/replication/slot.c +++ b/src/backend/replication/slot.c @@ -44,6 +44,7 @@ #include "common/string.h" #include "miscadmin.h" #include "pgstat.h" +#include "replication/logical.h" #include "replication/slot.h" #include "replication/message.h" #include "storage/fd.h" @@ -1201,7 +1202,7 @@ InvalidatePossiblyObsoleteSlot(ReplicationSlot *s, XLogRecPtr oldestLSN, * If the slot is already invalid or is fresh enough, we don't need to * do anything. */ - if (XLogRecPtrIsInvalid(restart_lsn) || restart_lsn >= oldestLSN) + if (XLogRecPtrIsInvalid(restart_lsn) || restart_lsn >= oldestLSN || Custom_XLogReaderRoutines) { SpinLockRelease(&s->mutex); if (released_lock)