Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3881aed

Browse files
committed
Fix recycling of WAL segments after changing recovery target timeline.
After the recovery target timeline is changed, we would still recycle andpreallocate WAL segments on the old target timeline. Those WAL segmentscreated for the old timeline are a waste of space, although otherwiseharmless.The problem is that when installing a recycled WAL segment as a future one,ThisTimeLineID is used to construct the filename. ThisTimeLineID isinitialized in the checkpointer process to the recovery target timeline atstartup, but it was not updated when the startup process chooses a newtarget timeline (recovery_target_timeline='latest'). To fix, always updateThisTimeLineID before recycling WAL segments at a restartpoint.This still leaves a small window where we might install WAL segments underwrong timeline ID, if the target timeline is changed just as we're about tostart recycling. Also, when we're not on the target timeline yet, but stillreplaying some older timeline, we'll install WAL segments to the newertimeline anyway and they will still go wasted. We'll just live with thewaste in that situation.Commit to 9.2 and 9.1. Older versions didn't change recovery target timelineafter startup, and for master, I'll commit a slightly different variant ofthis.
1 parent8e1e827 commit3881aed

File tree

1 file changed

+7
-0
lines changed
  • src/backend/access/transam

1 file changed

+7
-0
lines changed

‎src/backend/access/transam/xlog.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8415,6 +8415,13 @@ CreateRestartPoint(int flags)
84158415

84168416
KeepLogSeg(endptr,&_logId,&_logSeg);
84178417
PrevLogSeg(_logId,_logSeg);
8418+
8419+
/*
8420+
* Update ThisTimeLineID to the recovery target timeline, so that
8421+
* we install any recycled segments on the correct timeline.
8422+
*/
8423+
ThisTimeLineID=GetRecoveryTargetTLI();
8424+
84188425
RemoveOldXlogFiles(_logId,_logSeg,endptr);
84198426

84208427
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp