aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/transam/xlog.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/access/transam/xlog.c')
-rw-r--r--src/backend/access/transam/xlog.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index d808607ecdb..0b2f0c915b6 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -7637,6 +7637,19 @@ CreateRestartPoint(int flags)
KeepLogSeg(endptr, &_logSegNo);
_logSegNo--;
+
+ /*
+ * Update ThisTimeLineID to the timeline we're currently replaying,
+ * so that we install any recycled segments on that timeline.
+ *
+ * There is no guarantee that the WAL segments will be useful on the
+ * current timeline; if recovery proceeds to a new timeline right
+ * after this, the pre-allocated WAL segments on this timeline will
+ * not be used, and will go wasted until recycled on the next
+ * restartpoint. We'll live with that.
+ */
+ (void) GetXLogReplayRecPtr(&ThisTimeLineID);
+
RemoveOldXlogFiles(_logSegNo, endptr);
/*