diff options
Diffstat (limited to 'src/backend/access/transam/xlogarchive.c')
-rw-r--r-- | src/backend/access/transam/xlogarchive.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/backend/access/transam/xlogarchive.c b/src/backend/access/transam/xlogarchive.c index 4538f178acc..c899594fb67 100644 --- a/src/backend/access/transam/xlogarchive.c +++ b/src/backend/access/transam/xlogarchive.c @@ -619,9 +619,16 @@ XLogArchiveCheckDone(const char *xlog) { char archiveStatusPath[MAXPGPATH]; struct stat stat_buf; + bool inRecovery = RecoveryInProgress(); - /* Always deletable if archiving is off */ - if (!XLogArchivingActive()) + /* + * The file is always deletable if archive_mode is "off". On standbys + * archiving is disabled if archive_mode is "on", and enabled with + * "always". On a primary, archiving is enabled if archive_mode is "on" + * or "always". + */ + if (!((XLogArchivingActive() && !inRecovery) || + (XLogArchivingAlways() && inRecovery))) return true; /* First check for .done --- this means archiver is done with it */ |