forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit0d0501e
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 parentb487c39 commit0d0501e
1 file changed
+7
-0
lines changedLines changed: 7 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
8259 | 8259 |
| |
8260 | 8260 |
| |
8261 | 8261 |
| |
| 8262 | + | |
| 8263 | + | |
| 8264 | + | |
| 8265 | + | |
| 8266 | + | |
| 8267 | + | |
| 8268 | + | |
8262 | 8269 |
| |
8263 | 8270 |
| |
8264 | 8271 |
| |
|
0 commit comments
Comments
(0)