- Notifications
You must be signed in to change notification settings - Fork28
Commit09e96b3
committed
Fix handling of files that source server removes during pg_rewind is running.
After processing the filemap to build the list of chunks that will befetched from the source to rewing the target server, it is possible thata file which was previously processed is removed from the source. Asimple example of such an occurence is a WAL segment which gets recycledon the target in-between. When the filemap is processed, files notcategorized as relation files are first truncated to prepare for itsfull copy of which is going to be taken from the source, divided into aset of junks. However, for a recycled WAL segment, this would result ina segment which has a zero-byte size. With such an empty file,post-rewind recovery thinks that records are saved but they are actuallynot because of the truncation which happened when processing thefilemap, resulting in data loss.In order to fix the problem, make sure that files which are found asremoved on the source when receiving chunks of them are as well deletedon the target server for consistency.Back-patch to 9.5 where pg_rewind was added.Author: Tsunakawa TakayukiReviewed-by: Michael PaquierReported-by: Tsunakawa TakayukiDiscussion:https://postgr.es/m/0A3221C70F24FB45833433255569204D1F8DAAA2%40G01JPEXMBYT051 parentd92bc83 commit09e96b3
3 files changed
+20
-7
lines changedLines changed: 12 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
29 | 29 |
| |
30 | 30 |
| |
31 | 31 |
| |
32 |
| - | |
33 | 32 |
| |
34 | 33 |
| |
35 | 34 |
| |
| |||
134 | 133 |
| |
135 | 134 |
| |
136 | 135 |
| |
137 |
| - | |
| 136 | + | |
138 | 137 |
| |
139 | 138 |
| |
140 | 139 |
| |
| |||
165 | 164 |
| |
166 | 165 |
| |
167 | 166 |
| |
168 |
| - | |
169 |
| - | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
170 | 173 |
| |
171 | 174 |
| |
172 | 175 |
| |
| |||
175 | 178 |
| |
176 | 179 |
| |
177 | 180 |
| |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
178 | 185 |
| |
179 | 186 |
| |
| 187 | + | |
180 | 188 |
| |
181 | 189 |
| |
182 | 190 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
15 | 15 |
| |
16 | 16 |
| |
17 | 17 |
| |
| 18 | + | |
18 | 19 |
| |
19 | 20 |
| |
20 | 21 |
| |
|
Lines changed: 7 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
311 | 311 |
| |
312 | 312 |
| |
313 | 313 |
| |
314 |
| - | |
315 |
| - | |
316 |
| - | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
317 | 320 |
| |
318 | 321 |
| |
319 | 322 |
| |
320 | 323 |
| |
321 | 324 |
| |
322 | 325 |
| |
| 326 | + | |
323 | 327 |
| |
324 | 328 |
| |
325 | 329 |
| |
|
0 commit comments
Comments
(0)