From aecb5f2de5c9ef3d2e7a4a4f29a7de61f8665373 Mon Sep 17 00:00:00 2001 From: Jehan-Guillaume de Rorthais Date: Tue, 31 Mar 2020 16:56:40 +0200 Subject: [PATCH] Fix WAL retention during production crash recovery During crash recovery of a production cluster with archive_mode=on, XLogArchiveCheckDone() was considering the cluster as inRecovery without archive_mode=always. Because of this non-arcived WAL and related .ready files were recycled or removed. --- src/backend/access/transam/xlogarchive.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/access/transam/xlogarchive.c b/src/backend/access/transam/xlogarchive.c index d62c12310a..088206ac38 100644 --- a/src/backend/access/transam/xlogarchive.c +++ b/src/backend/access/transam/xlogarchive.c @@ -580,7 +580,7 @@ XLogArchiveCheckDone(const char *xlog) * "always". On a primary, archiving is enabled if archive_mode is "on" * or "always". */ - if (!((XLogArchivingActive() && !inRecovery) || + if (!((XLogArchivingActive() && !StandbyModeRequested) || (XLogArchivingAlways() && inRecovery))) return true; -- 2.20.1