diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 62862255fc..1215776672 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -8094,10 +8094,6 @@ StartupXLOG(void) if (!XLogRecPtrIsInvalid(XLogCtl->lastReplayedEndRecPtr)) promoted = PerformRecoveryXLogAction(); - /* If this is archive recovery, perform post-recovery cleanup actions. */ - if (ArchiveRecoveryRequested) - CleanupAfterArchiveRecovery(EndOfLogTLI, EndOfLog); - /* * If any of the critical GUCs have changed, log them before we allow * backends to write WAL. @@ -8105,6 +8101,10 @@ StartupXLOG(void) LocalSetXLogInsertAllowed(); XLogReportParameters(); + /* If this is archive recovery, perform post-recovery cleanup actions. */ + if (ArchiveRecoveryRequested) + CleanupAfterArchiveRecovery(EndOfLogTLI, EndOfLog); + /* * Local WAL inserts enabled, so it's time to finish initialization of * commit timestamp.