diff options
Diffstat (limited to 'src/backend/access/transam/xlog.c')
-rw-r--r-- | src/backend/access/transam/xlog.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index bc9024847b0..69d4e19554c 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -5601,7 +5601,6 @@ readRecoveryCommandFile(void) static void exitArchiveRecovery(TimeLineID endTLI, XLogRecPtr endOfLog) { - char recoveryPath[MAXPGPATH]; char xlogfname[MAXFNAMELEN]; XLogSegNo endLogSegNo; XLogSegNo startLogSegNo; @@ -5682,17 +5681,6 @@ exitArchiveRecovery(TimeLineID endTLI, XLogRecPtr endOfLog) XLogArchiveCleanup(xlogfname); /* - * Since there might be a partial WAL segment named RECOVERYXLOG, get rid - * of it. - */ - snprintf(recoveryPath, MAXPGPATH, XLOGDIR "/RECOVERYXLOG"); - unlink(recoveryPath); /* ignore any error */ - - /* Get rid of any remaining recovered timeline-history file, too */ - snprintf(recoveryPath, MAXPGPATH, XLOGDIR "/RECOVERYHISTORY"); - unlink(recoveryPath); /* ignore any error */ - - /* * Rename the config file out of the way, so that we don't accidentally * re-enter archive recovery mode in a subsequent crash. */ @@ -7544,6 +7532,7 @@ StartupXLOG(void) if (ArchiveRecoveryRequested) { char reason[200]; + char recoveryPath[MAXPGPATH]; Assert(InArchiveRecovery); @@ -7600,6 +7589,17 @@ StartupXLOG(void) */ writeTimeLineHistory(ThisTimeLineID, recoveryTargetTLI, EndRecPtr, reason); + + /* + * Since there might be a partial WAL segment named RECOVERYXLOG, get + * rid of it. + */ + snprintf(recoveryPath, MAXPGPATH, XLOGDIR "/RECOVERYXLOG"); + unlink(recoveryPath); /* ignore any error */ + + /* Get rid of any remaining recovered timeline-history file, too */ + snprintf(recoveryPath, MAXPGPATH, XLOGDIR "/RECOVERYHISTORY"); + unlink(recoveryPath); /* ignore any error */ } /* Save the selected TimeLineID in shared memory, too */ |