- Notifications
You must be signed in to change notification settings - Fork5
Commit343ee00
committed
Fix recycling of WAL segments after switching timeline during recovery.
This was broken before, we would recycle old WAL segments on wrong timelineafter the recovery target timeline had changed, but my recent commit tonot initialize ThisTimeLineID at all in a standby's checkpointer processbroke this completely.The problem is that when installing a recycled WAL segment as a future one,ThisTimeLineID is used to construct the filename. To fix, always updateThisTimeLineID to the current timeline being recovered, before recyclingWAL segments at a restartpoint.This still leaves a small window where we might install WAL segments underwrong timeline ID, if the timeline is changed just as we're about to startrecycling. Also, even if we're replaying timeline X at the momnent, there'sno guarantee that we'll need as many WAL segments on that timeline as werecycle. We might be just about to reach the point where we switch to nexttimeline, so might only need one more WAL segment on the current timeline.We'll live with the waste in that situation.Bug pointed out by Fujii Masao. 9.1 and 9.2 had the same issue, whenrecovery target timeline was changed, but I committed a slightly differentversion of this patch on those branches.1 parentdc9896a commit343ee00
1 file changed
+13
-0
lines changedLines changed: 13 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
7637 | 7637 |
| |
7638 | 7638 |
| |
7639 | 7639 |
| |
| 7640 | + | |
| 7641 | + | |
| 7642 | + | |
| 7643 | + | |
| 7644 | + | |
| 7645 | + | |
| 7646 | + | |
| 7647 | + | |
| 7648 | + | |
| 7649 | + | |
| 7650 | + | |
| 7651 | + | |
| 7652 | + | |
7640 | 7653 |
| |
7641 | 7654 |
| |
7642 | 7655 |
| |
|
0 commit comments
Comments
(0)