diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 7d34218..d106a13 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -7456,9 +7456,11 @@ CreateRestartPoint(int flags) KeepLogSeg(endptr, &_logSegNo); _logSegNo--; + RemoveOldXlogFiles(_logSegNo, endptr); + /* - * Update ThisTimeLineID to the timeline we're currently replaying, - * so that we install any recycled segments on that timeline. + * Make more log segments if needed. (Do this after recycling old log + * segments, since that may supply some of the needed files.) * * There is no guarantee that the WAL segments will be useful on the * current timeline; if recovery proceeds to a new timeline right @@ -7466,14 +7468,6 @@ CreateRestartPoint(int flags) * not be used, and will go wasted until recycled on the next * restartpoint. We'll live with that. */ - (void) GetXLogReplayRecPtr(&ThisTimeLineID); - - RemoveOldXlogFiles(_logSegNo, endptr); - - /* - * Make more log segments if needed. (Do this after recycling old log - * segments, since that may supply some of the needed files.) - */ PreallocXlogFiles(endptr); } @@ -9098,10 +9092,10 @@ GetXLogReplayRecPtr(TimeLineID *replayTLI) SpinLockAcquire(&xlogctl->info_lck); recptr = xlogctl->lastReplayedEndRecPtr; tli = xlogctl->lastReplayedTLI; + if (replayTLI && xlogctl->SharedRecoveryInProgress) + *replayTLI = tli; SpinLockRelease(&xlogctl->info_lck); - if (replayTLI) - *replayTLI = tli; return recptr; }